Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>update:</p> <p><strong><a href="http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html" rel="nofollow noreferrer">http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html</a></strong></p> <p>not sure if this can be set up in an appserver but i'll give it a go. only thing that worries me is management of the scope. the container manages the scope along transaction boundaries </p> <pre><code>//inject entity manager @Inject("mySpecialEntityManager") EntityManager em; //then mark the actual factory method in the factory bean with @Produces("mySpecialEntityManager") </code></pre> <p>but then how to manage scope is the problem</p> <hr> <p>2.2.2. Bootstrapping</p> <p>The JPA specification defines a bootstrap procedure to access the EntityManagerFactory and the EntityManager. The bootstrap class is javax.persistence.Persistence, e.g.</p> <p>Map configOverrides = new HashMap();</p> <p>configOverrides.put("hibernate.hbm2ddl.auto", "create-drop");</p> <p>EntityManagerFactory programmaticEmf =</p> <pre><code>Persistence.createEntityManagerFactory("manager1", configOverrides); </code></pre> <p>The first version is equivalent to the second with an empty map. The map version is a set of overrides that will take precedence over any properties defined in your persistence.xml files. All the properties defined in Section 2.2.1, “Packaging” can be passed to the createEntityManagerFactory method and there are a few additional ones:</p> <pre><code>* javax.persistence.provider to define the provider class used * javax.persistence.transactionType to define the transaction type used (either JTA or RESOURCE_LOCAL) * javax.persistence.jtaDataSource to define the JTA datasource name in JNDI * javax.persistence.nonJtaDataSource to define the non JTA datasource name in JNDI * javax.persistence.lock.timeout pessimistic lock timeout in milliseconds (Integer or String) * javax.persistence.query.timeout query timeout in milliseconds (Integer or String) * javax.persistence.sharedCache.mode corresponds to the share-cache-mode element defined in Section 2.2.1, “Packaging”. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload