J2EE JDBC based authentication with JPA Entities in Glassfish

One of the authentication options you get in Glassfish is to store your users/roles just in database tables. This way you can implement your custom UIs and logic for managing users. Usual solution you’ll find over the web for that is to create them by hand with SQL and fill using JDBC. What I needed was to get some entities for the users so I just could start my app and everything is created by JPA. This is not that easy, as Glassfish has some assuptions about tables you use (as it’s also using plain JDBC to retrieve users from database). Here’s how I’ve managed to do it using JPA 2.0 entities:
Continue reading…

%d bloggers like this: