title: Hibernate OGM with MongoDB persistence exception
body: <p>I fighing with hibernate. I'm trying to follow hibernate.org/ogm/documentation/getting-started/ . Here are my files
   - persistence.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" 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"&gt;
    &lt;persistence-unit name="ogm-jpa-tutorial" transaction-type="JTA"&gt;
      &lt;!-- Use Hibernate OGM provider: configuration will be transparent --&gt;
      &lt;provider&gt;org.hibernate.ogm.jpa.HibernateOgmPersistence&lt;/provider&gt;
      &lt;class&gt;com.mycompany.hibernate.MyEntity&lt;/class&gt;
      &lt;properties&gt;
        &lt;property name="hibernate.ogm.datastore.provider" value="MONGODB"/&gt;
        &lt;!-- property optional if you plan and use Infinispan, otherwise adjust to your favorite
                  NoSQL Datastore provider.
              &lt;property name="hibernate.ogm.datastore.provider"
                        value="org.hibernate.ogm.datastore.infinispan.impl.InfinispanDatastoreProvider"/&gt;
              --&gt;
        &lt;!-- defines which JTA Transaction we plan to use --&gt;
        &lt;property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"/&gt;
        &lt;property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>entity class:</p>
  
  <pre><code>@Entity
  @Table(name = "USstates")
  public class MyEntity implements Serializable{
     @Id 
     String _id;
     String city;
     Integer pop;
    String state;
    public String getId(){return _id;}
    public String getCity(){return city;}
    public Integer getPop(){return pop;}
    public String getState(){return state;}
  
  } 
  </code></pre>
  
  <p>application</p>
  
  <pre><code>private static final String JBOSS_TM_CLASS_NAME = "com.mycompany.hibernate.TransactionManager";
      public static void main( String[] args ) throws Exception
      {
          EntityManagerFactory emf = Persistence.createEntityManagerFactory(
      "ogm-jpa-tutorial");
  
  TransactionManager tm = getTransactionManager();
  //Persist entities the way you are used to in plain JPA
  tm.begin();
  
  EntityManager em = emf.createEntityManager();
  MyEntity e = new MyEntity();
  e = new MyEntity();
  //Retrieve your entities the way you are used to in plain JPA
  tm.begin();
  em = emf.createEntityManager();
  e = em.find(MyEntity.class, "0");
  em.flush();
  em.close();
  tm.commit();
  
  emf.close();
  
      }
  
          public static TransactionManager getTransactionManager() {
  try {
  Class&lt;?&gt; tmClass = App.class.getClassLoader().loadClass( JBOSS_TM_CLASS_NAME );
  return (TransactionManager) tmClass.getMethod( "transactionManager" ).invoke( null );
  } catch ( ClassNotFoundException e ) {
  e.printStackTrace();
  } catch ( InvocationTargetException e ) {
  e.printStackTrace();
  } catch ( NoSuchMethodException e ) {
  e.printStackTrace();
  } catch ( IllegalAccessException e ) {
  e.printStackTrace();
  }
  return null;
  }
  </code></pre>
  
  <p>I have database test with collection USstates taken from <a href="http://media.mongodb.org/zips.json" rel="nofollow">http://media.mongodb.org/zips.json</a></p>
  
  <p>Using thic codes I got some wornings about logs and what more important exception while running this application: </p>
  
  <pre><code>Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: ogm-jpa-tutorial] Unable to build Hibernate SessionFactory
  </code></pre>
  
  <p>any ideas?</p>
  
  <p>UPDATE:</p>
  
  <p>after fighting i got an error of non exising class, I already tried milions of combinations of dependency and still got nothing... error:    </p>
  
  <p>Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/util/xml/Origin</p>
  
  <p>UPDATE 2.0:
  Now I have other problem:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.cfg.Configuration.getIdentifierGeneratorFactory()Lorg/hibernate/id/factory/spi/MutableIdentifierGeneratorFactory;
      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1119)
      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:291)
      at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:373)
      at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
      at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:92)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
      at com.mycompany.hibernate.App.main(App.java:48)
  </code></pre>