Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 23B0585F1 for ; Wed, 10 Aug 2011 16:04:28 +0000 (UTC) Received: (qmail 78006 invoked by uid 500); 10 Aug 2011 16:04:28 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 77815 invoked by uid 500); 10 Aug 2011 16:04:27 -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 77800 invoked by uid 99); 10 Aug 2011 16:04:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 16:04:26 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of curtisr7@gmail.com designates 209.85.215.170 as permitted sender) Received: from [209.85.215.170] (HELO mail-ey0-f170.google.com) (209.85.215.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2011 16:04:20 +0000 Received: by eyd10 with SMTP id 10so1290669eyd.15 for ; Wed, 10 Aug 2011 09:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=b3JuJKNmvFt8EGmBrfKzqKX2Ib/6UAb7LTPFE4pbuP0=; b=P7OaV2dx9QYQQrz9/IcjcRNDNsbb4MiCaiROXda4KHQRWSnylNpcHIZe+K/iO70nHk uyxuE6u9plMv6dDqev+A0I5PMR4qxhV7RSykv1KKK7vxQ3lunpfz0/guqlZq30zXlvRm hJUkhIXwuURGC4Q8M047S9J9sYiH33h6GyHwM= MIME-Version: 1.0 Received: by 10.213.10.2 with SMTP id n2mr253590ebn.45.1312992239702; Wed, 10 Aug 2011 09:03:59 -0700 (PDT) Received: by 10.213.105.131 with HTTP; Wed, 10 Aug 2011 09:03:59 -0700 (PDT) In-Reply-To: References: Date: Wed, 10 Aug 2011 11:03:59 -0500 Message-ID: Subject: Re: Problems when using "openjpa.MetaDataFactory" Property From: Rick Curtis To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=0015174bde6e0a520c04aa28d426 X-Virus-Checked: Checked by ClamAV on apache.org --0015174bde6e0a520c04aa28d426 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable See if setting this property works for you. --> Thanks, Rick On Wed, Aug 10, 2011 at 10:48 AM, Marcel Urbanek wrot= e: > Sure. > > My Entity looks like the following: > > @Entity > @Table(name=3D"MPTZZY") > public class Group extends UpdateEntity{ > > /*Remark text*/ > @Column(name =3D "TE_RMK", > length=3D20) > private String remarkText; > [...] > > > The according Junit Test is the following (EJB-Services are implemented > straight forward): > > GroupServiceLocal tempGroupService =3D (GroupServiceLocal) > initialContext.lookup(GroupServiceLocal.class.getCanonicalName()); > PersonServiceLocal tempPersonService =3D (PersonServiceLocal) > initialContext.lookup(PersonServiceLocal.class.getCanonicalName()); > GroupPK tempPK=3Dnew GroupPK(); > > Person tempPerson=3Dnew Person(); > tempPerson.getId().setPersonName("Marcel"); > tempPerson.setAgeNumber((short) 29); > tempPerson.setRemarkText("TEST"); > > Group tempGroup=3Dnew Group(); > tempGroup.getId().setGroupName("AA Team"); > tempGroup.getId().setGroupNumber((short)1); > tempGroup.getId().setValidFromDate(new Date()); > tempGroup.setRemarkText("AA Team"); > tempGroup.getPersons().add(tempPerson); > tempPerson.setGroup(tempGroup); > tempGroupService.createGroup(tempGroup); > > When running the test with the following property in the persistence.xml: > > > > everything works fine. > > But when I change the property into: > > "org.apache.openjpa.persistence.PersistenceMetaDataFactory"/> > > (which should be essentially the same, according to the document mentione= d > in the mail before) the test fails with following error message: > > > org.apache.openjpa.persistence.PersistenceException: > DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: > I01W90.GROUPSQLCA OUTPUT[Errp=3DDSNXERT2, Errd=3D-335, 0, 0, -1, 0, 0] > DB2 SQL error: SQLCODE: -516, SQLSTATE: 26501, SQLERRMC: null > DB2 SQL error: SQLCODE: -518, SQLSTATE: 07003, SQLERRMC: null > FailedObject: prepstmnt 18898317 INSERT INTO i01w90.Group > (groupName, groupNumber, validFromDate, remarkText, date, time, user) > VALUES (?, ?, ?, ?, ?, ?, ?) > [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement] > > Obviously OpenJPA now does not use the column names I specified (for > example "TE_RMK") but instead uses the Java attribute name ("remarkText")= . > > Best regards Marcel > > > > > From: Rick Curtis > To: users@openjpa.apache.org > Date: 10.08.2011 16:12 > Subject: Re: Problems when using "openjpa.MetaDataFactory" Propert= y > > > > Can you post a unit test to help us better understand where you're runnin= g > into problems? > > Thanks, > Rick > > On Wed, Aug 10, 2011 at 4:49 AM, Marcel Urbanek > wrote: > > > Hi, > > > > I want to overwrite the MetaDataFactory like described here: > > > > > > http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/r= ef_guide_meta.html > > > > > But it turned out it doesn't work. I managed to develop a test scenario > > which easily produces the behaviour I encountered. > > > > What _does_ work is the following: > > > > Adding > > > > to persistence.xml. > > > > When setting this property my junit test (persisting a simple > association, > > using @Column Annotation to use differing column names) does work. > > > > > > According to the document above, this property Tag should be equivalent > to > > the setting above: > > > > > value=3D"org.apache.openjpa.persistence.PersistenceMetaDataFactory"/> > > > > But when using this configuration my junit test fails. The differing > > Column Names set by the @Column.name Attribute are no longer found. > > Instead the Java Attribute-Names are used in the SQL. > > > > My problem is, that I want to implement a custom MetaDataFactory and > this > > doesn't work either (which is expected, because I extend > > PersistenceMetaDataFactory). Is there something I missed? > > > > (I'm using openjpa 2.11 with openejb 4.0.0 snapshot) > > > > Best regards Marcel > > -- > > RSC Commercial Services GmbH & Co. OHG, Wanheimer Strasse 70, D-40468 > > Duesseldorf - Sitz: Duesseldorf - Registergericht: Duesseldorf HRA 1265= 5 > > Persoenlich haftende Gesellschafter: > > C&A Retail GmbH - Sitz: Zug/Schweiz - Handelsregister Kanton Zug: > > CH-170.4.010.137-5 > > Geschaeftsfuehrer: Bart F. Brenninkmeijer, Martijn N. N. Brenninkmeijer= , > > Tjeerd E. van der Zee, Robert H. A. M. Smeele, Anthony H. Stam, > > FRM PARTICIPATIONS S.A. - Sitz: Luxemburg/Luxemburg - Handels- und > > Firmenregister Luxemburg: B 58158 > > Verwaltungsratsmitglieder: Rafael G. E. Bogaerts, John Drury, Michel de > > Groote, Johny Ser=E9, Robert H. A. M. Smeele > > > > > > > -- > *Rick Curtis* > > > -- > RSC Commercial Services GmbH & Co. OHG, Wanheimer Strasse 70, D-40468 > Duesseldorf - Sitz: Duesseldorf - Registergericht: Duesseldorf HRA 12655 > Persoenlich haftende Gesellschafter: > C&A Retail GmbH - Sitz: Zug/Schweiz - Handelsregister Kanton Zug: > CH-170.4.010.137-5 > Geschaeftsfuehrer: Bart F. Brenninkmeijer, Martijn N. N. Brenninkmeijer, > Tjeerd E. van der Zee, Robert H. A. M. Smeele, Anthony H. Stam, > FRM PARTICIPATIONS S.A. - Sitz: Luxemburg/Luxemburg - Handels- und > Firmenregister Luxemburg: B 58158 > Verwaltungsratsmitglieder: Rafael G. E. Bogaerts, John Drury, Michel de > Groote, Johny Ser=E9, Robert H. A. M. Smeele > > --=20 *Rick Curtis* --0015174bde6e0a520c04aa28d426--