<< Back to previous view

[NUCJPA-98] Support AttributeOverride syntax for nested embedded fields Created: 10/Jan/11  Updated: 01/Feb/11  Resolved: 10/Jan/11

Status: Closed
Project: DataNucleus API JPA
Component/s: API
Affects Version/s: 2.1.0.release, 2.1.1, 2.1.2, 2.1.3, 2.1.4
Fix Version/s: 2.1.5, 3.0.0.m1

Type: Bug Priority: Major
Reporter: Andy Jefferson Assignee: Andy Jefferson
Resolution: Fixed Votes: 0


 Description   
When you override the column name of a nested embedded you use syntax like "fieldA.fieldB". This currently results in
java.lang.NoSuchFieldException: zipcode.zip
        at java.lang.Class.getDeclaredField(Class.java:1882)
        at org.datanucleus.api.jpa.metadata.JPAAnnotationReader.processMemberAnnotations(JPAAnnotationReader.java:1080)
        at org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:170)
        at org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:134)
        at org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:2343)
        at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:817)

An example

    @Embeddable public class Address {
        protected String street;
        protected String city;
        protected String state;
        @Embedded protected Zipcode zipcode;
    }

    @Embeddable public class Zipcode {
        protected String zip;
        protected String plusFour;
    }

    @Entity public class Customer {
        @Id protected Integer id;
        protected String name;

        @AttributeOverrides({
            @AttributeOverride(name="state",
                               column=@Column(name="ADDR_STATE")),
            @AttributeOverride(name="zipcode.zip",
                               column=@Column(name="ADDR_ZIP"))
        })
        @Embedded protected Address address;
        ...
    }

 Comments   
Comment by Andy Jefferson [ 10/Jan/11 10:56 AM ]
SVN for 2.1 and 3.0 support this now (for fields)
Generated at Fri Jan 19 02:43:41 CET 2018 using JIRA 4.0#466.