openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "francisco treacy" <>
Subject problem enhancing embeddable class
Date Sun, 16 Dec 2007 16:00:51 GMT

i migrated my application from hibernate jpa to openjpa a couple of
weeks ago, and except for an issue with sublists the integration was

i later changed my DI framework (spring to guice) and in some of those
changes i started having "Could not locate metadata for the class
using alias... " errors. it was then that i found out i had to list
all my entities in persistence.xml.
i don't get why it didn't happen before, or with hibernate. i know
it's in the spec, but anyway my question is:  is there a way to avoid
listing every class in persistence.xml? or, instead, a way to indicate
the package? i feel it's kind of like going against "don't repeat
yourself", considering all these classes are already annotated.

but my real problem comes when i want to create (ddd) value objects.
these don't have identity and as such, should be "embedded" to
entities. i followed this post

for instance, my Doctor entity has an Address. i'm using the
@Embeddable annotation in the Address class and @Entity in Doctor,
which has an @Embedded Address attribute.

if i don't put <class>test.domain.Address</class> in the
persistence.xml file, i get a
<openjpa-1.0.1-r420667:592145 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: One or more of the
types in [(here lots classes...)] have relations to other unenhanced
types that were not specified. These unspecified types are: [class

if i do, i get a
     at org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(
     at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(
     at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(

it should work like that, since enhancement is optional. but i decided
trying to enhance all entities by executing the ant task (and not
listing Address in persistence.xml), i get a
<openjpa-1.0.1-r420667:592145 fatal user error>
org.apache.openjpa.persistence.ArgumentException: The type "class
test.domain.Address" has not been enhanced.

if i do list it, while executing the ant task i get a
     [java] Exception in thread "main" <openjpa-1.0.1-r420667:592145
nonfatal general error> org.apache.openjpa.util.GeneralException: An
error occurred while enhancing test.domain.Address. Exception message:
     [java] 	at
     [java] 	at

any ideas? what am i doing wrong?

thanks in advance!


View raw message