Issue Details (XML | Word | Printable)

Key: NUCJPA-98
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus API JPA

Support AttributeOverride syntax for nested embedded fields

Created: 10/Jan/11 08:33 AM   Updated: 01/Feb/11 08:37 PM   Resolved: 10/Jan/11 10:56 AM
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


 Description  « Hide
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;
        ...
    }

Andy Jefferson added a comment - 10/Jan/11 10:56 AM
SVN for 2.1 and 3.0 support this now (for fields)

Andy Jefferson made changes - 10/Jan/11 10:56 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.1.5 [ 11117 ]
Fix Version/s 3.0.0.m1 [ 11071 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Feb/11 08:37 PM
Status Resolved [ 5 ] Closed [ 6 ]