I've programatically created an
EntityManagerFactory like this:
This works perfect and now I would like to make it available to the application for injection via the
The same is done by the Hibernate ORM, at least the documentation says:
For compliant container-bootstrapping, the container will build an EntityManagerFactory for each persistent-unit defined in the META-INF/persistence.xml configuration file and make that available to the application for injection via the javax.persistence.PersistenceUnit annotation or via JNDI lookup.
Can I achive the same and how is it done?
In the end we do not really inject the the EntityManagerFactory, but look it up like this:
I guess it makes no difference in the end?!