Hi Leon,
I took a look at the way you're setting up the mapping in the
afterloads, and that looks to be fine to me. We have some test cases
that do a similar reference mapping (with @address-id going to @id on
an Address) that's set up in code that to works, so I'm not sure why
your attribute isn't getting populated.
If you send me your test case, I can walk through in the debugger and
see what's going on. I would have to see the rest of your project to
know if there's an issue.
-Matt
During debugging I noticed that IndustrialFamily had no primary key
(code). This was giving the exception.
I could not define a primary key for IndustrialFamily in the workbench.
Is this currently not supported?
I tried to workaround this problem using afterload methods and doing
this in Java.
This is my code:
public static void afterFamilyLoader(ClassDescriptor familyDescriptor)
{
familyDescriptor.setJavaClass(IndustrialFamily.class);
familyDescriptor.addPrimaryKeyFieldName("@code");
}
public static void afterProductLoader(ClassDescriptor
productDescriptor) {
XMLObjectReferenceMapping product = new
XMLObjectReferenceMapping();
product.setAttributeName("industrialFamily");
product.setReferenceClass(IndustrialFamily.class);
product.addSourceToTargetKeyFieldAssociation("@familyCode",
"@code");
productDescriptor.addMapping(product);
}
I don't get a stacktrace any more. But now the family is null in my
Product Object.
Is there still something missing in my mapping?
Leon
Leon Derks wrote:
Hello
I have a problem (stacktrace) using the XML Object Reference Mapping in
the workbench tool from EclipseLink 1.0M6.
This is my xml data:
<CatalogProduct code="123JI" name="BSN Lamp" type="Lamp"
familyCode="BSN-BC4H">
.....
</CatalogProduct>
<IndustrialFamilies>
<IndustrialFamily code="BSN-BC4H" name="Family Lamps"
productCategoryCode="Lamps"/>
</IndustrialFamilies>
I mapped this in the workbench as an XML Object Reference with Source
Xpath=@familyCode and Target Xpath=@code.
In the eclipselink documentation I read that XML Object Reference is
only supported in Java and not in the workbench. Is this still the
case?
Running an unmarshall application in Eclipse, results in the following
stacktrace:
javax.xml.bind.UnmarshalException
- with linked exception:
[java.lang.ArrayIndexOutOfBoundsException: -1]
at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:102)
at
com.philips.lighting.research.jaxb.UnmarshallXml.main(UnmarshallXml.java:31)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.Vector.setElementAt(Unknown Source)
at
org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping.buildReference(XMLObjectReferenceMapping.java:147)
at
org.eclipse.persistence.internal.oxm.XMLObjectReferenceMappingNodeValue.attribute(XMLObjectReferenceMappingNodeValue.java:91)
at
org.eclipse.persistence.oxm.record.UnmarshalRecord.startElement(UnmarshalRecord.java:600)
at
org.eclipse.persistence.internal.oxm.XMLRelationshipMappingNodeValue.processChild(XMLRelationshipMappingNodeValue.java:72)
at
org.eclipse.persistence.internal.oxm.XMLCompositeCollectionMappingNodeValue.startElement(XMLCompositeCollectionMappingNodeValue.java:89)
at
org.eclipse.persistence.oxm.record.UnmarshalRecord.startElement(UnmarshalRecord.java:558)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at
org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:99)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:216)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:193)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:274)
at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:100)
... 1 more
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Hello
I have a problem (stacktrace) using the XML Object Reference Mapping in
the workbench tool from EclipseLink 1.0M6.
This is my xml data:
<CatalogProduct code="123JI" name="BSN Lamp" type="Lamp"
familyCode="BSN-BC4H">
.....
</CatalogProduct>
<IndustrialFamilies>
<IndustrialFamily code="BSN-BC4H" name="Family Lamps"
productCategoryCode="Lamps"/>
</IndustrialFamilies>
I mapped this in the workbench as an XML Object Reference with Source
Xpath=@familyCode and Target Xpath=@code.
In the eclipselink documentation I read that XML Object Reference is
only supported in Java and not in the workbench. Is this still the
case?
Running an unmarshall application in Eclipse, results in the following
stacktrace:
javax.xml.bind.UnmarshalException
- with linked exception:
[java.lang.ArrayIndexOutOfBoundsException: -1]
at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:102)
at
com.philips.lighting.research.jaxb.UnmarshallXml.main(UnmarshallXml.java:31)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.Vector.setElementAt(Unknown Source)
at
org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping.buildReference(XMLObjectReferenceMapping.java:147)
at
org.eclipse.persistence.internal.oxm.XMLObjectReferenceMappingNodeValue.attribute(XMLObjectReferenceMappingNodeValue.java:91)
at
org.eclipse.persistence.oxm.record.UnmarshalRecord.startElement(UnmarshalRecord.java:600)
at
org.eclipse.persistence.internal.oxm.XMLRelationshipMappingNodeValue.processChild(XMLRelationshipMappingNodeValue.java:72)
at
org.eclipse.persistence.internal.oxm.XMLCompositeCollectionMappingNodeValue.startElement(XMLCompositeCollectionMappingNodeValue.java:89)
at
org.eclipse.persistence.oxm.record.UnmarshalRecord.startElement(UnmarshalRecord.java:558)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at
org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:99)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:216)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:193)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:274)
at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:100)
... 1 more
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|