openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tierney, Mary K (GE Healthcare)" <kate.tier...@ge.com>
Subject Trouble with persistent element (extended schema) when field name does not match column name
Date Wed, 30 Apr 2014 14:09:16 GMT
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


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