Try specifying your types also --> <property name="openjpa.MetaDataFactory"
value="org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory(types=com.retail_sc.test.entity.Group;com.retail_sc.test.entity.Group2;...etc/>

This happens at runtime, but I can't find where it happens atm.

On Wed, Aug 10, 2011 at 11:12 AM, Marcel Urbanek <dt0...@retail-sc.com>wrote:

> Then following Stacktrace is displayed:
>
> Caused by: <openjpa-1.2.1-r752877:753278 fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Errors encountered while
> resolving metadata.  See nested exceptions for details.
>        at
>
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:563)
>        at
>
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
> ...
> Caused by: java.lang.IllegalStateException: No registered metadata for
> type "class com.retail_sc.test.entity.Group".
>        at
> org.apache.openjpa.enhance.PCRegistry.getMeta(PCRegistry.java:255)
>        at
> org.apache.openjpa.enhance.PCRegistry.newInstance(PCRegistry.java:111)
> ...
>
> Best regards Marcel
>
>
>
> From:   Rick Curtis <curti...@gmail.com>
> To:     users@openjpa.apache.org
> Date:   10.08.2011 18:04
> Subject:        Re: Problems when using "openjpa.MetaDataFactory" Property
>
>
>
> See if setting this property works for you. --> <property
> name="openjpa.MetaDataFactory"
> value="org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory/>
>
> Thanks,
> Rick
>
>
> On Wed, Aug 10, 2011 at 10:48 AM, Marcel Urbanek
> <dt0...@retail-sc.com>wrote:
>
> > 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 <curti...@gmail.com>
> > To:     users@openjpa.apache.org
> > 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
> > <dt0...@retail-sc.com>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
> >
> >
>
>
> --
> *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
>
>


-- 
*Rick Curtis*

Reply via email to