How to use it in Google App Engine with JPA 2.0?

217 views
Skip to first unread message

asmilk ceng

unread,
Mar 14, 2013, 11:36:41 PM3/14/13
to java-gen...@googlegroups.com
Hi All,

I try to use it in Google App Engine 1.7.5 with JPA 2.0, and the Datanucleus JPA version is V2.

here is the lib in the classpath:
  • datanucleus-api-jpa-3.1.3.jar
  • datanucleus-appengine-2.1.2.jar
  • datanucleus-core-3.1.3.jar
  • datanucleus-enhancer-3.1.1.jar
  • geronimo-jpa_2.0_spec-1.0.jar
  • jdo-api-3.0.1.jar
  • jta-1.1.jar
  • asm-4.0.jar
  • dao-1.1.0.jar
  • search-1.1.0.jar
  • persistence-api-1.0.jar
  • slf4j-api-1.7.2.jar
EntityManager entityManager = EMF.get().createEntityManager();
JPAAnnotationMetadataUtil metadataUtil = new JPAAnnotationMetadataUtil();
JPASearchProcessor searchProcessor = new JPASearchProcessor(metadataUtil);

PersonDaoImpl personDao = new PersonDaoImpl();
personDao.setEntityManager(entityManager);
personDao.setSearchProcessor(searchProcessor);

Search search = new Search(Person.class);
search.addFilterEqual("name", "asmilk");
List<Person> personList = personDao.search(search);
for(Person person : personList) {
        LOG.info("Item:" + person.toString());
}


Then I got this error:

Uncaught exception from servlet
java.lang.NoSuchFieldError: PESSIMISTIC_READ
	at org.datanucleus.api.jpa.JPAQuery.getResultList(JPAQuery.java:171)
	at com.googlecode.genericdao.search.jpa.JPASearchProcessor.search(JPASearchProcessor.java:81)
	at com.googlecode.genericdao.dao.jpa.JPABaseDAO._search(JPABaseDAO.java:322)
	at com.googlecode.genericdao.dao.jpa.GenericDAOImpl.search(GenericDAOImpl.java:123)

If I change Datanucleus JPA version to V1 which use datanucleus-core-1.1.5.jar. I can use the same code to get the result without any error. any idea for this?

Regards,
Asmilk Ceng





David Wolverton

unread,
Mar 15, 2013, 7:39:40 AM3/15/13
to java-gen...@googlegroups.com
Try the newest version of the framework, described here https://groups.google.com/forum/?fromgroups=#!topic/java-generic-dao/ATcVfJzF7IE. It is supposed to support JPA 2.

This is currently a snapshot release, but I think it's pretty much final and ready to go to release so don't worry about it changing.

Let us know how it goes.








--
You received this message because you are subscribed to the Google Groups "java-generic-dao" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-generic-d...@googlegroups.com.
To post to this group, send email to java-gen...@googlegroups.com.
Visit this group at http://groups.google.com/group/java-generic-dao?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

asmilk ceng

unread,
Mar 22, 2013, 3:04:24 AM3/22/13
to java-gen...@googlegroups.com
Hi David,

I change to use spring-data-jpa which is also work fine with GAE.

Regards,
Asmilk Ceng

kannan.k...@gmail.com

unread,
Oct 12, 2013, 10:12:46 PM10/12/13
to java-gen...@googlegroups.com
Hi ,
 
I have recently downloaded the same set of jars and working fine in eclipse . But i got same problem after uploaded into Google App engine server.
 
is there anything to do with transaction settings ?
 
regards,,
Kannan

krzysztof...@gmail.com

unread,
Jan 2, 2015, 4:34:36 PM1/2/15
to java-gen...@googlegroups.com
It is persistence-api-1.0.jar which causes the problem. geronimo-jpa_2.0_spec-1.0.jar has newer version of JPA API, so you can just remove persistence-api-1.0.jar and everything will work fine.
Reply all
Reply to author
Forward
0 new messages