Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 37045 invoked from network); 18 Jul 2007 08:02:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jul 2007 08:02:25 -0000 Received: (qmail 94362 invoked by uid 500); 18 Jul 2007 08:02:14 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 94335 invoked by uid 500); 18 Jul 2007 08:02:14 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 94324 invoked by uid 99); 18 Jul 2007 08:02:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jul 2007 01:02:14 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [194.31.14.20] (HELO mail20.dbh.de) (194.31.14.20) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jul 2007 01:02:11 -0700 Received: from unknown (HELO exchange.dbh.de) ([172.22.22.26]) by mail20.dbh.de with ESMTP; 18 Jul 2007 10:01:49 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: AW: AW: Problems using openJPA X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 18 Jul 2007 10:01:49 +0200 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: AW: Problems using openJPA Thread-Index: AcfIub+SAvQboJkgTf2OtRF3lsQyZAAUoj0g From: "Ueberbach, Michael" To: X-Virus-Checked: Checked by ClamAV on apache.org Hello David, To your last question: The SUN spec says=20 "In addition to returning and setting the persistent state of the = instance, the property accessor methods may contain other business logic as well, for example, to perform = validation. The persistence provider runtime executes this logic when property-based access is used." openJPA follows this in offering the two possibilities of accessing. The = openJPA manual says "JPA offers two modes of persistent state access: field access, and = property access. To use property access, set your entity element's access attribute to = PROPERTY, or place your metadata and mapping annotations on the getter = method. Each class must use either field access or property access for all = state; you cannot use both access types within the same class." The whole problem is that the described way to choose the property = access by placing the annotations at the getter methods does not show = any effects. More worse openJPA throws an org.apache.openjpa.util.UserException (as = described) and does not choose any of the two alternative ways. This exceptions sounds as if the annotations set at the getter methods = were not reckognized when parsing the entity classes. The question for = me is: Have I to do something more (or have I chosen the wrong annotations or = what ever) to get this code working? The test with jboss was done to see whether there also an error would be = visible, but it was not. I agree that this gives no final security about = the compliance of jboss. Indeed my aim is to get the thing working on = geronimo/openJPA! Thanks for any help Michael =20 -----Urspr=FCngliche Nachricht----- Von: David Jencks [mailto:david_jencks@yahoo.com]=20 Gesendet: Dienstag, 17. Juli 2007 23:30 An: user@geronimo.apache.org Betreff: Re: AW: Problems using openJPA On Jul 17, 2007, at 9:25 AM, Ueberbach, Michael wrote: > Hi Jacek, > > I had to make a little break, now I'm trying to get back to the last=20 > situation. > > Following your last advices: > > reducing the persistance.xml to the neccessary elements works for=20 > deploying, but does not help in fetching data. In fact the same=20 > exception (...Could not locate metadata for the class ...) is thrown. > > I checked the code again: > - no field is annotated > - every getter is annotated (at least with @Basic) > - every other method named with get... Is annotated @Transient > > Therefore the access type has to be clear (=3D PROPERTY). =20 > Nevertheless this is not recognized. > > So I've tried two things: > > First: > I put a xml mapping file (orm.xml) inside the deployment jar, where I = > explicitly set the access type to PROPERTY for all classes. > The deployment works, but the warning > > "<1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> > org.apache.openjpa.util.UserException: Type=20 > "de.lama.sample3.stammdaten.ejb.PersonBean" attempts to use both field = > and property access. Only one access method is permitted." > > remains and the method call still doesn't work. > > Second: > I deployed the whole stuff unchanged (except the deployment plan) to a = > jboss server(4.04) to compare the results. Here everything works as=20 > expected. > > As result it seems to me that if there isn't an error inside the=20 > deployed code that jboss does not find, there must be something wrong=20 > with parsing the classes annotations in geronimo resp. openjpa. I haven't looked into your problem in detail, but I don't think you can = conclude from hibernate's ability to deploy an app X that X is entirely = spec compliant and can be deployed on all other compliant jpa = implementations. Out of curiousity why are you using property access? I have yet to = understand why anyone would do this given a choice.... hoping for = enlightenment. thanks david jencks > > > regards > Michael > > > -----Urspr=FCngliche Nachricht----- > Von: Ueberbach, Michael [mailto:michael.ueberbach@dbh.de] > Gesendet: Dienstag, 10. Juli 2007 18:06 > An: user@geronimo.apache.org; jacek@laskowski.net.pl > Betreff: AW: Problems using openJPA > > Hi Jacek, > > Thanks for your hints. To the first point: I've already seen this in=20 > the spec. I'm quite shure there is no access via the instance=20 > variables (but I will prove it again). I will also try to eliminate=20 > the entries in persistance.xml that are not neccessary. I'll tell the=20 > results as soon as possible. > > Michael > > -----Urspr=FCngliche Nachricht----- > Von: eljotpl@gmail.com [mailto:eljotpl@gmail.com] Im Auftrag von Jacek = > Laskowski > Gesendet: Dienstag, 10. Juli 2007 11:19 > An: user@geronimo.apache.org > Betreff: Re: Problems using openJPA > > On 7/10/07, Ueberbach, Michael wrote: >> Hello Jacek, >> >> meanwhile I'm able to send the jar I deployed to geronimo. I attach=20 >> it to this mail, sources should be included. Also the persistence.xml = >> that is used. >> As you can see I put @Basic annotations to all property getters=20 >> explicitly (although I think this should be default) to make shure=20 >> that access should be done by property (and not by field). >> Nevertheless this seems not be recognized by openJPA. It would be=20 >> great if you have any idea why and what should be done. > > Hi Michael, > > I've just started looking into it, but thought I'd tell you that when=20 > you use property-based access (via getters) you should not access the=20 > entity state via instance fields. > > You don't need to specify vendor element in the persistence.xml file. > Geronimo defaults to OpenJPA. According to the spec (6.2.1.4 provider > p.135): > > The provider element must be specified if the application is dependent = > upon a particular persistence provider being used. > > You don't need to specify class elements in Java EE env (as opposed to = > Java SE env). The container looks for other files unless exclude-=20 > unlisted-classes element is specified (which is not the case in your=20 > example). > > See if that helps out. Going to spot other (mis)uses of the spec that=20 > might cause the trouble. > > Jacek > > -- > Jacek Laskowski > http://www.JacekLaskowski.pl