Is it possible to use JPA and dynamic based user authentication with the database? I would like to capture the users credentials in a form and authenticate them with the database and have JPA use that connection. I am not interested in Realms, because it sound likes I would need to set up additional tables. If the user is an authorized database user, that is all that is required for the application. I don't want to expose a user-id and password in a "configuration" xml file.
Also, I have three database environments (with the same schema), and would like to be able to specify which database server to use at run time.
Concepts required to solve this problem, steps and an example would be appreciated.
Application is JSF 2.0 currently using container managed persistence via EclipseLink.
I tried passing the data source in the properties map to the constructor for the EntityManager / EntityManagerFactory, and believe I achieved partial success for one entity. I believe I stumbled because the JPA split my single database table into two entities, presumably because of a two column key and I did not know how to address that issue. Data retrieval worked, but data update failed.
I will study the references you provided, many thanks.
In the mean time I cloned the project and replaced JPA with application controlled database connection and SQL statement coding.
subject: JPA and dynamic user authentication with the database