views:

404

answers:

3

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>
  ...
A: 

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.

DataNucleus
Yes I'm using this within a Eclipse/GWT Plugin enviroment which afaik emulates an appengine. I'm really new to both hibernate and GWT. I'm running the above script a seperate class with main method and not in context of the appengine though.
iNPUTmice
GAE/J Eclipse plugin is for AppEngine and hence BigTable; no idea what a GWT plugin is. Hibernate will not provide persistence to BigTable, clearly. DataNucleus is the only provider for JPA persistence to BigTable. Suggest that you resolve what is your dev environment if not intending on persisting to BigTable
DataNucleus
A: 

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.

Pascal Thivent
A: 

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.

iNPUTmice