title: hibernate-ogm apache ignite does not work
body: <p>I am still trying to get my head around the whole OGM/Apache Ignite thing, I couldn't find an example on the net that worked.</p>
  
  <p>So I tried this
  pom.xml</p>
  
  <pre><code>&lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;h2.version&gt;1.4.195&lt;/h2.version&gt;
      &lt;ignite.version&gt;2.4.0&lt;/ignite.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate.ogm&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-ogm-ignite&lt;/artifactId&gt;
          &lt;version&gt;5.3.1.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.2.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.ignite&lt;/groupId&gt;
          &lt;artifactId&gt;ignite-core&lt;/artifactId&gt;
          &lt;version&gt;${ignite.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.ignite&lt;/groupId&gt;
          &lt;artifactId&gt;ignite-spring&lt;/artifactId&gt;
          &lt;version&gt;${ignite.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.ignite&lt;/groupId&gt;
          &lt;artifactId&gt;ignite-indexing&lt;/artifactId&gt;
          &lt;version&gt;${ignite.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.narayana.jta&lt;/groupId&gt;
          &lt;artifactId&gt;narayana-jta&lt;/artifactId&gt;
          &lt;version&gt;5.4.0.Final&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Ignite version 2.6.0 didn't work with hibernate-ogm 5.3.1 Final</p>
  
  <p>TestOGM</p>
  
  <pre><code>package com.example;
  
  import au.com.bueno.issue.issue.model.Breed;
  import au.com.bueno.issue.issue.model.Dog;
  import org.apache.ignite.Ignite;
  import org.apache.ignite.IgniteCluster;
  import org.apache.ignite.Ignition;
  import org.hibernate.ejb.HibernateEntityManagerFactory;
  import org.hibernate.engine.spi.SessionFactoryImplementor;
  import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
  
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  import javax.transaction.*;
  
  public class TestOgm {
      public static void main(String[] args) throws SystemException, NotSupportedException, HeuristicRollbackException, HeuristicMixedException, RollbackException {
  // Connect to the cluster.
  
      Ignite ignite = Ignition.start();
  
      ignite.cluster().active(true);
      TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
      EntityManagerFactory emf = Persistence.createEntityManagerFactory(
              "ogm-jpa-tutorial");
  
      tm.begin();
      EntityManager em = emf.createEntityManager();
      Breed collie = new Breed();
      collie.setName("Collie");
      em.persist(collie);
      Dog dina = new Dog();
      dina.setName("Dina");
      dina.setBreed(collie);
      em.persist(dina);
      Long dinaId = dina.getId();
      System.out.println("dina " + dinaId);
      System.out.println("em = " + em.find(Dog.class, 1L));
      em.flush();
      em.close();
      tm.commit();
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  </code></pre>
  
  <p>http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
               version="2.0"></p>
  
  <pre><code>&lt;persistence-unit name="ogm-jpa-tutorial" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.hibernate.ogm.jpa.HibernateOgmPersistence&lt;/provider&gt;
      &lt;properties&gt;
  
          &lt;property name="com.arjuna.ats.jta.jtaTMImplementation" value="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImpl"/&gt;
          &lt;property name="com.arjuna.ats.jta.jtaUTImplementation" value="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImpl"/&gt;
  
          &lt;property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.ignite.impl.IgniteDatastoreProvider"/&gt;
          &lt;property name="hibernate.ogm.ignite.configuration_class_name" value="com.example.configuration.ConfigurationBuilder"/&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>I got this exception when I ran it</p>
  
  <pre><code>class org.apache.ignite.IgniteCheckedException: Failed to deserialize object with given class loader: sun.misc.Launcher$AppClassLoader@18b4aac2
  at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:147)
  at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:94)
  at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9847)
  at org.apache.ignite.spi.discovery.tcp.ServerImpl$SocketReader.body(ServerImpl.java:5913)
  at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
  Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.hibernate.boot.registry.internal.StandardServiceRegistryImp
  </code></pre>
  
  <p>However, it kept going and I could see the output produced as below </p>
  
  <pre><code>21:25:39.828 [main] DEBUG 
  
  org.hibernate.event.internal.AbstractSaveEventListener - Generated identifier: 1, using strategy: org.hibernate.ogm.id.impl.OgmTableGenerator
  dina 1
  em = Dog{id=1, name='Dina', breed=Breed{id='5fc25a4d-c03c-4f2b-b5f9-9812a5c3dedb', name='Collie'}}
  </code></pre>
  
  <p>I can't seem to find the table Breed or Dog anywhere in the database. I tried to enable persistence storage to true, but I didn't know how to do it, the api for version 2.4.0 is not same as what's on the web site right now. 
  e.g I tried </p>
  
  <pre><code>Ignite ignite = Ignition.start();
  
  ignite.cluster().active(true);
  </code></pre>
  
  <p>it didn't help. </p>
  
  <p>How would I start <code>bin/ignite.sh</code> and activate cluster for it by using <code>bin/control.sh --activate</code> and then make my example above write to it?</p>
  
  <p>Thanks &amp; regards
  Tin</p>