Nested Embeddable bug? [message #1060293] |
Fri, 24 May 2013 00:05 |
Roger Spall Messages: 17 Registered: January 2013 |
Junior Member |
|
|
I have an Embeddable called Address which in turn contains an Embeddable called ZipCode. Finally I have an Entity called Contact which contains an Address.
<embeddable access="FIELD" class="com.yamaha.ydsus.common.model.domain.ZipCode">
<attributes>
<basic name="zipCode"/>
</attributes>
</embeddable>
<embeddable access="FIELD" class="com.yamaha.ydsus.common.model.domain.Address">
<attributes>
<basic name="street1"/>
<basic name="city"/>
<basic name="stateCode"/>
<embedded name="zipCode" attribute-type="com.yamaha.ydsus.common.model.domain.ZipCode"/>
</attributes>
</embeddable>
<entity access="FIELD" class="com.yamaha.yds.model.domain.dealerprofile.DealerContactImpl">
<table name="DEALER_CONTACT"/>
<attributes>
<id name="oid">
<column name="OID"/>
<generated-value generator="DEALER_CONTACT_SEQ" strategy="SEQUENCE"/>
<sequence-generator allocation-size="1" name="DEALER_CONTACT_SEQ" sequence-name="DEALER_CONTACT_SEQ"/>
</id>
<basic name="email">
<column name="EMAIL"/>
</basic>
.... other fields and relationships
<embedded name="address">
<attribute-override name="zipCode.zipCode">
<column name="ZIP"/>
</attribute-override>
<attribute-override name="street1">
<column name="STREET_ADDRESS"/>
</attribute-override>
<attribute-override name="stateCode">
<column name="STATE"/>
</attribute-override>
<attribute-override name="city">
<column name="CITY"/>
</attribute-override>
</embedded>
</attributes>
</entity>
Anyway, with weaving turned on, whenever I create a new DealerContact with a new Address with a NULL ZipCode I get a null pointer exception when my SessionBean tries to commit / exit. Turning off weaving fixes the problem...
[Servlet Error]-[action]: javax.ejb.EJBException: nested exception is: java.lang.NullPointerException
java.lang.NullPointerException
at org.eclipse.persistence.mappings.AggregateMapping.updateChangeRecord(AggregateMapping.java:908)
at org.eclipse.persistence.mappings.AggregateMapping.updateChangeRecord(AggregateMapping.java:955)
at org.eclipse.persistence.internal.descriptors.changetracking.AttributeChangeListener.internalPropertyChange(AttributeChangeListener.java:149)
at org.eclipse.persistence.internal.descriptors.changetracking.AttributeChangeListener.propertyChange(AttributeChangeListener.java:111)
at com.yamaha.ydsus.common.model.domain.dealerprofile.DealerContact._persistence_propertyChange(DealerContact.java)
at com.yamaha.yds.model.domain.dealerprofile.DealerContactImpl._persistence_set_address(DealerContactImpl.java)
at com.yamaha.yds.model.domain.dealerprofile.DealerContactImpl.setAddress(DealerContactImpl.java:167)
at com.yamaha.yds.apps.dealerprofile.DealerProfileManagerBean.saveDealerContact(DealerProfileManagerBean.java:466)
This code was converted from Native Eclipselink / Toplink, and worked just fine with null ZipCodes. Of course, I can create a Null ZipCode object to get around the problem, but would like to understand if this is a bug, or something wrong with my mapping?
Just to be clear, our object model / database design expects null ZipCodes, so we would like to support this design.
From looking at the source code for the AggregateMapping class, it doesn't seem to expect nested embeddables to be null when using weaving for change management?
Eclipselink version 2.4.1.v20121003-ad44345
Many thanks,
Roger
[Updated on: Fri, 24 May 2013 00:08] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02727 seconds