Phương Nguyễn
Phương Nguyễn

Reputation: 8905

Google App Engine: JDO does the job, JPA does not

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 compact source code of the maven projects that reproduce that problem: Updated: http://seamoo.com/jpa-bug-reproduce-compact.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.

Upvotes: 0

Views: 1563

Answers (1)

DataNucleus
DataNucleus

Reputation: 15577

So you either haven't enhanced your model classes, or haven't provided persistence metadata (XML, annotations) for them (at runtime). The log tells you ample information. And I really don't think that presenting people with some tgz with 3 separate projects and expecting them to find the particular class that you're referring to could be called "optimum usage of their time". Cut it down to the actual class, its metadata and a sample Main

Upvotes: 2

Related Questions