Question

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>
  ...
Was it helpful?

Solution 3

I was using the wrong JPA Wrapper classes. I was using geronimo-jpa.jar before and I ended up using the javax-persistance.jar from Glassfish. Dunno if this is a sweet solution but at least it is one.

OTHER TIPS

So tell me, are you using this on GAE/J ? DataNucleus is obviously in the CLASSPATH since it is in your log saying just this.

Quoting the Creating a New Web Application section from the Google Plugin for Eclipse documentation:

Creating a Project with the New Web Application Wizard

The New Web Application Project wizard allows you to create a new web application that uses Google Web Toolkit (GWT) and/or Google App Engine:

alt text

Did you select Use Google App Engine at project creation time? If yes, don't.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top