title: How to use TomEE with Hibernate
body: <p>I have created very simple app with persistence context (hibernate as provider) to read some value from database. I use Eclipse with Maven.</p>
  
  <p>First, I get</p>
  
  <pre><code>Caused by: org.apache.openejb.OpenEJBException: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider:
  </code></pre>
  
  <p>and according to this topic
  <a href="http://openejb.979440.n4.nabble.com/problem-with-hibernate-persistence-provider-td980429.html" rel="noreferrer">http://openejb.979440.n4.nabble.com/problem-with-hibernate-persistence-provider-td980429.html</a>
  I excluded hibernate-jpa-2.0-api. Now, my dependencies look</p>
  
  <pre><code>&lt;dependency&gt;
   &lt;groupId&gt;postgresql&lt;/groupId&gt;
   &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
   &lt;version&gt;9.1-901.jdbc4&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
   &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
   &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
   &lt;version&gt;4.1.3.Final&lt;/version&gt;
    &lt;exclusions&gt;
      &lt;exclusion&gt;
        &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
      &lt;/exclusion&gt;
    &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Now, I don't know why...</p>
  
  <pre><code>Caused by: java.lang.ClassNotFoundException: org.hibernate.transaction.TransactionManagerLookup
  </code></pre>
  
  <p>But TransactionManagerLookup is in hibernate-core.
  Please, can anybody tell me, how should look pom.xml to use hibernate in TomEE?</p>