Google App Engine: JDO does the job, JPA does not
- by Phuong Nguyen de ManCity fan
I have setup a project using both Jdo and Jpa.
I used Jpa Annotation to Declare my Entity.
Then I setup my testCases based on LocalTestHelper (from Google App Engine Documentation).
When I run the test,
a call to makePersistent of Jdo:PersistenceManager is perfectly OK;
a call to persist of Jpa:EntityManager raised an error:
java.lang.IllegalArgumentException: Type ("org.seamoo.persistence.jpa.model.ExampleModel") is not that of an entity but needs to be for this operation
at org.datanucleus.jpa.EntityManagerImpl.assertEntity(EntityManagerImpl.java:888)
at org.datanucleus.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:385)
Caused by: org.datanucleus.exceptions.NoPersistenceInformationException: The class "org.seamoo.persistence.jpa.model.ExampleModel" is required to be persistable yet no Meta-Data/Annotations can be found for this class. Please check that the Meta-Data/annotations is defined in a valid file location.
at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:3894)
at org.datanucleus.jpa.EntityManagerImpl.assertEntity(EntityManagerImpl.java:884)
... 27 more
How can it be the case?
Below is the link to the source code of the maven projects that reproduce that problem:
http://seamoo.com/jpa-bug-reproduce.tar.gz
Execute the maven test goal over the parent pom you will notice that 3/4 tests from org.seamoo.persistence.jdo.JdoGenericDAOImplTest passed, while all tests from org.seamoo.persistence.jpa.JpaGenericDAOImplTest failed.