Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 34082 invoked from network); 16 Dec 2007 18:23:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Dec 2007 18:23:17 -0000 Received: (qmail 9542 invoked by uid 500); 16 Dec 2007 18:23:05 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 9525 invoked by uid 500); 16 Dec 2007 18:23:05 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 9516 invoked by uid 99); 16 Dec 2007 18:23:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Dec 2007 10:23:05 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of plinskey@gmail.com designates 64.233.178.251 as permitted sender) Received: from [64.233.178.251] (HELO hs-out-2122.google.com) (64.233.178.251) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Dec 2007 18:22:44 +0000 Received: by hs-out-2122.google.com with SMTP id x43so1830531hsb.9 for ; Sun, 16 Dec 2007 10:22:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=I1OO+2W9veAN1nPsUWgkMEvMlpMrJnaVKB7GXJmS5ho=; b=M9cBlxwpiQUbVRN831NStRqAS5JFOGTLBOeoXLETZ3cDyGD+6IaLLq2C2lYf7RtN1kkdkSQaNgXaU2vGx5p/mpvvs/AhZVq405m1D0HzcMu/2eVszdm8nvtLfWKRtRwkcvvIkfvsnZM3uQVdqLBbVVY5+RhYvW5FssZ0DAOT9bQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dzmg524p6ckbTMisQmRLZizp0JRQnVonriL1kFLeq7rzkh+4Lr+/SsO3aLm6a+h3V8pXzY782vDk9iQDNH95nhqSM/nsj9ppUo89WJ+T7tNo6+CFcA7XDeg1D5sAcQx9363aSE2zDlybW+/VHWM1hi1tJvcAjwvJJOtaKymalMM= Received: by 10.150.133.17 with SMTP id g17mr1992586ybd.27.1197829366373; Sun, 16 Dec 2007 10:22:46 -0800 (PST) Received: by 10.150.158.20 with HTTP; Sun, 16 Dec 2007 10:22:46 -0800 (PST) Message-ID: <7262f25e0712161022l1b6b1a7cj3893bacfa71b78a7@mail.gmail.com> Date: Mon, 17 Dec 2007 02:22:46 +0800 From: "Patrick Linskey" To: users@openjpa.apache.org Subject: Re: problem enhancing embeddable class In-Reply-To: <41c8480f0712160800i12c58476mc4ffa6a9cafb7e9f@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <41c8480f0712160800i12c58476mc4ffa6a9cafb7e9f@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org > if i do, i get a > java.lang.NullPointerException > at org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(PCEnhancer.java:3680) > at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEnhancer.java:858) > at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEnhancer.java:807) > (...) Do you do anything interesting in your getters or setters for the embedded field? > if i do list it, while executing the ant task i get a > [java] Exception in thread "main" nonfatal general error> org.apache.openjpa.util.GeneralException: An > error occurred while enhancing test.domain.Address. Exception message: > null > [java] at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:470) > [java] at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4349) Is that the full stack? What is output if you set the openjpa.Log property to 'Enhance=TRACE, Tool=TRACE'? Also, FYI, what you're doing sounds legal, and we do have test cases that exercise embedded fields, so there must be something odd going on. Do you have some sample code that you could post? -Patrick On Dec 17, 2007 12:00 AM, francisco treacy wrote: > hi, > > i migrated my application from hibernate jpa to openjpa a couple of > weeks ago, and except for an issue with sublists the integration was > seamless. > > 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 > http://debasishg.blogspot.com/2007/09/domain-modeling-with-jpa-gotchas-part-2.html. > > 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 test.domain.Address in the > persistence.xml file, i get a > > 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 > test.domain.Address] > > if i do, i get a > java.lang.NullPointerException > at org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(PCEnhancer.java:3680) > at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEnhancer.java:858) > at org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEnhancer.java:807) > (...) > > 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 > > 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" nonfatal general error> org.apache.openjpa.util.GeneralException: An > error occurred while enhancing test.domain.Address. Exception message: > null > [java] at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:470) > [java] at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4349) > > > any ideas? what am i doing wrong? > > thanks in advance! > > francisco > -- Patrick Linskey 202 669 5907