[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] XML Object Reference Mapping
 | 
Hello Neil,
Thanks for the support.
We also found out that the workbench.cmd file in 1.0M6 is missing the 
line "set CLASSPATH=%CLASSPATH%;%THIS%..\..\jlib\jpa\persistence.jar"
Because without this jar file you wil get an exception when exporting a 
Project Deployment XML.
greetz,
Leon
Neil Hauge wrote:
Hi Leon,
We're looking into this.  I can tell you that there is a limitation in 
the Workbench right now on being able to specify the primary key for 
the reference descriptor.  The approach you are taking with the 
afterload methods appears to be correct.  We'll get back to you on 
this soon.
Neil
Leon Derks wrote:
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
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users