openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Trouble with persistent element (extended schema) when field name does not match column name
Date Wed, 07 May 2014 13:36:44 GMT
Really?  That was it?  Normally, that xml element just says not to look at
annotations, everything is in the xml...  If you can document this as a
JIRA [1], it would be appreciated.  Thanks.

Kevin

[1]  https://openjpa.apache.org/found-a-bug.html


On Wed, May 7, 2014 at 8:17 AM, <kate.tierney@ge.com> wrote:

> I figured out my problem. I was missing  metadata-complete="true" on my
> entity element. Once I added that, the error went away.
>
> Thanks!
>
> <quote author='Kevin Sutter'>
> Have you tried turning on trace?  The simple column name mapping is part of
> the spec, so that should work regardless.  Applying the externalizer is an
> OpenJPA extension to the orm.xml, but it doesn't even seem like you are
> getting that far.  Maybe the trace will help show where the processing is
> going awry...  Good luck!
>
> Kevin
>
>
> On Wed, Apr 30, 2014 at 7:09 AM, Tierney, Mary K (GE Healthcare) <
> kate.tierney@ge.com> wrote:
>
> > I have the following:
> >
> > public abstract class Person {
> > ...
> >                 protected Boolean isActive;
> > ...
> > }
> >
> > Person table with column "IsInactiveFLAG" - char(1)
> >
> > I am trying to use the Externalizer/Factory combo to transform the value
> > into a Boolean for use in code.
> >
> > In my orm.xml file (using the extended schema), I have the following:
> >
> > <basic name="isActive">
> >
> > <orm:column name="IsInactiveFLAG" column-definition="char(1)"/>
> >                                                 </basic>
> >                                                 <openjpa:attributes>
> >
> > <openjpa:persistent name="isActive"
> >
> >       externalizer="InvertedYesNoMapper.toDbValue"
> >
> >       factory="InvertedYesNoMapper.toValue"/>
> >                                                 </openjpa:attributes>
> >
> > I get the following error at runtime:
> >
> > ...Person.isActive" declares column "isActive", but this column does not
> > exist in table "dbo.PERSON"
> > at
> >
> org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:692)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:593)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:178)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:84)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:146)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:82)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:496)
> >                 at
> > org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:461)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:895)
> >                 at
> >
> org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:416)
> >                 at
> >
> org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:768)
> >                 at
> >
> org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:657)
> >                 at
> >
> org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:417)
> >                 at
> >
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:388)
> >                 at
> >
> org.apache.openjpa.persistence.meta.MetamodelImpl.<init>(MetamodelImpl.java:85)
> >                 at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:346)
> >                 at
> >
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.getMetamodel(EntityManagerFactoryImpl.java:60)
> > ...
> >
> > When I use attributes in the class, this all works fine.
> >
> > Do I have to have matching field/column names in order to use this
> > functionality in my orm.xml?
> > Please let me know if more information would be helpful.
> >
> > Thanks,
> > Kate
> >
> >
>
> </quote>
> Quoted from:
>
> http://openjpa.208410.n2.nabble.com/Trouble-with-persistent-element-extended-schema-when-field-name-does-not-match-column-name-tp7586297p7586324.html
>
>
> _____________________________________
> Sent from http://openjpa.208410.n2.nabble.com
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message