All,
I'm a proposing a slight change to ObjectBuilder to resolve the
above-mentioned issue.
On (or near, depending on the build) line 1783 in the
extractPrimaryKeyFromObject(Object, AbstractSession, boolean) method in
ObjectBuilder the code is:
- AbstractRecord
databaseRow = createRecord(size, session);
I am proposing it be changed to:
- AbstractRecord
databaseRow = createRecordForPKExtraction(size, session);
Where createRecordForPKExtraction()
would be:
/**
* Create a new row/record for the object builder. This allows
subclasses to
* define different record types. This will typically be called
when a
* record will be used for temporarily holding on to primary key
fields.
*/
protected AbstractRecord createRecordForPKExtraction(int size,
AbstractSession session) {
return createRecord(size, session);
}
This will allow us (in XMLObjectBuilder) to return the correct record
type for primary key extraction purposes. Please let me know if you
have any issues or concerns with these changes. For reference, here is
the bug
description:
The TCK test
DefineTypesTest.testDynamicTypesGroup1() involves a schema where a
complex type contains an unbounded element of type xsd:ID. A null
pointer exception occurs upon load operation:
java.lang.NullPointerException
at
org.eclipse.persistence.internal.sessions.AbstractRecord.put(AbstractRecord.java:593)
at
org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping.writeFromObjectIntoRow(XMLCompositeDirectCollectionMapping.java:342)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(ObjectBuilder.java:1780)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(ObjectBuilder.java:1731)
at
org.eclipse.persistence.internal.oxm.XMLObjectBuilder.extractPrimaryKeyFromObject(XMLObjectBuilder.java:444)
at
org.eclipse.persistence.oxm.record.UnmarshalRecord.endDocument(UnmarshalRecord.java:481)
...
This occurs because we are returning the wrong record type for this
mapping (composite direct collection) during primary key extraction.
The code in ObjectBuilder simply calls createRecord(size, session)
which in XMLObjectBuilder returns an UnmarshalRecord. In this case,
however, we need a DOMRecord such that the code can perform get and put
operations (which are not supported in unmarshal record).
--
David
McCann |
Principal Software Engineer | TopLink Product
Oracle
Corporation Canada
45 O'Connor Street, Suite 400
Ottawa, Ontario K1P 1A4
Canada
613.288.4636
613.238.2818 (fax)
|