Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/OutsideContainer"

Line 1: Line 1:
Users may also use the EntityManager API outside the container.  
+
Users may also use the EntityManager API outside the container by creating a EntityManagerFactory for a given persistence unit name and properties map (includes database information etc.)
  
== Using a persistence unit name ==
 
 
<code><pre>
 
<code><pre>
 
EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnitName, propertiesMap);
 
EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnitName, propertiesMap);
 
EntityManager em = emf.createEntityManager();
 
EntityManager em = emf.createEntityManager();
 
</pre></code>
 
</pre></code>

Revision as of 11:59, 16 October 2007

Users may also use the EntityManager API outside the container by creating a EntityManagerFactory for a given persistence unit name and properties map (includes database information etc.)

EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnitName, propertiesMap);
EntityManager em = emf.createEntityManager();

Back to the top