Sure.

My Entity looks like the following:

        @Entity
        @Table(name="MPTZZY")
        public class Group extends UpdateEntity{
 
                /*Remark text*/
                @Column(name = "TE_RMK",
                                length=20)
                private String  remarkText;
        [...]


The according Junit Test is the following (EJB-Services are implemented 
straight forward):

        GroupServiceLocal tempGroupService = (GroupServiceLocal) 
initialContext.lookup(GroupServiceLocal.class.getCanonicalName());
        PersonServiceLocal tempPersonService = (PersonServiceLocal) 
initialContext.lookup(PersonServiceLocal.class.getCanonicalName());
        GroupPK tempPK=new GroupPK();
 
        Person tempPerson=new Person();
        tempPerson.getId().setPersonName("Marcel");
        tempPerson.setAgeNumber((short) 29);
        tempPerson.setRemarkText("TEST");
 
        Group tempGroup=new 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:

        <property name="openjpa.MetaDataFactory" value="jpa"/>

everything works fine. 

But when I change the property into:

        <property name="openjpa.MetaDataFactory" value=
"org.apache.openjpa.persistence.PersistenceMetaDataFactory"/>

(which should be essentially the same, according to the document mentioned 
in the mail before) the test fails with following error message:

        <openjpa-1.2.1-r752877:753278 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: 
        DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: 
I01W90.GROUPSQLCA OUTPUT[Errp=DSNXERT2, Errd=-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 <[email protected]>
To:     [email protected]
Date:   10.08.2011 16:12
Subject:        Re: Problems when using "openjpa.MetaDataFactory" Property



Can you post a unit test to help us better understand where you're running
into problems?

Thanks,
Rick

On Wed, Aug 10, 2011 at 4:49 AM, Marcel Urbanek 
<[email protected]>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/ref_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
> <property name="openjpa.MetaDataFactory" value="jpa"/>
> 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:
>
> <property name="openjpa.MetaDataFactory"
> value="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 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é, 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é, Robert H. A. M. Smeele

Reply via email to