Skip to content

Instantly share code, notes, and snippets.

@ziparo
Created June 5, 2012 15:42
Show Gist options
  • Save ziparo/2875823 to your computer and use it in GitHub Desktop.
Save ziparo/2875823 to your computer and use it in GitHub Desktop.
---------- How we create the entity manager: ------------
private static final EntityManagerFactory emf = Persistence.createEntityManagerFactory("geograph-persistence-unit");
----------- Error:------------
[6/5/12 5:41:08 PM] fabio cottefoglie: Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named geograph-persistence-unit
   [junit]    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
   [junit]    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
   [junit]    at org.cloudtm.framework.ogm.HibOgmTxManager.<clinit>(HibOgmTxManager.java:27)
--------- persistence.xml ------------
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
            version="2.0">
   <persistence-unit name="geograph-persistence-unit" transaction-type="JTA">
       <!-- Use Hibernate OGM provider: configuration will be transparent -->
       <!-- <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider> -->
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <properties>
           <!-- or any transaction manager lookup implementation you want in your environment -->
           <property name="hibernate.transaction.manager_lookup_class"
                     value="org.hibernate.transaction.JBossTSStandaloneTransactionManagerLookup" />
           <!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> -->
           <property name="hibernate.cache.use_second_level_cache" value="false" />
           <property name="hibernate.ogm.infinispan.configuration_resourcename" value="infinispanNoFile.xml" />
           <!-- <property name="hibernate.cache.use_query_cache" value="true" /> -->
       </properties>
   </persistence-unit>
</persistence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment