persistence.xml ignores Hibernate and chooses DataNucleus

Posted by iNPUTmice on Stack Overflow See other posts from Stack Overflow or by iNPUTmice
Published on 2010-02-18T12:32:42Z Indexed on 2010/03/31 11:43 UTC
Read the original article Hit count: 515

Filed under:
|
|
|
|

Hi,

I'm toying around with GWT (dunno if this matters) and Hibernate. I've created a a file persistence.xml in META-INF with (amoung) other configuration the line: org.hibernate.ejb.HibernatePersistence But when I startup the EntityManager it chooses DataNucleus instead of Hibernate (which later fails because it isnt installed (jar are not in the class path))

Java Code is:

EntityManagerFactory factory = Persistence.createEntityManagerFactory("gwt");
EntityManager em =factory.createEntityManager();
EntityTransaction transacation = em.getTransaction();
transacation.begin();
Campaign campaign = new Campaign();
campaign.setName("Test");
em.persist(campaign);
transacation.commit();

config file contains:

<?xml version="1.0" encoding="UTF-8"?>
<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_1_0.xsd"
  version="1.0">
  <persistence-unit name="gwt" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/DefaultDS</jta-data-source>
      <properties>
  ...

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate