Set password runtime with Hibernate / JPA

Viewed 836

I have a web app with a db connection properties defined in persistence.xml.

I am using contained manager persistence with the entity manager injected using @PersistenceContext.

Today the password to the DB is in the persistence.xml file, but I would rather set it runtime (ask the user for it).

I am able to create a new EntityManager with the password runtime, but how can I "override" the injected one?

Any other good ideas/approaches?

1 Answers
Related