|
Re: Name collision when using super-type in moxy oxm.xml [message #1106830 is a reply to message #1104289] |
Wed, 11 September 2013 15:57 |
|
I wasn't able to get the same exception as you, but I did notice some problems with your metadata file:
- You have java-attribute elements where you meant to have xml-attribute.
- You did not fully qualify the class name for the specified super-type.
- You did not specify the type for the xml-attribute mappings.
oxm.xml
Below is an updated version of your oxm.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" xml-accessor-type="NONE" xml-mapping-metadata-complete="true" package-name="com.flexdms.flexims.model.generated">
<java-types>
<java-type name="TypedQuery">
<xml-root-element name="TypedQuery"/>
<java-attributes>
<xml-element java-attribute="id" name="id" xml-id="true"/>
<xml-attribute java-attribute="Name" name="Name" required="true" type="java.lang.String"/>
<xml-attribute java-attribute="Type" name="Type" required="true" type="java.lang.String"/>
</java-attributes>
</java-type>
<java-type name="ConditionQuery" super-type="com.flexdms.flexims.model.generated.TypedQuery">
<xml-root-element name="ConditionQuery"/>
<java-attributes/>
</java-type>
<java-type name="SingleInt">
<xml-root-element name="SingleInt"/>
<java-attributes>
<xml-element java-attribute="id" name="id" xml-id="true"/>
<xml-attribute java-attribute="DateCreated" name="DateCreated" required="true" type="java.util.Date"/>
<xml-attribute java-attribute="DateModified" name="DateModified" required="true" type="java.util.Date"/>
<xml-attribute java-attribute="defaultCase" name="defaultCase" type="java.lang.String"/>
<xml-attribute java-attribute="withdefault" name="withdefault" type="java.lang.Boolean"/>
<xml-attribute java-attribute="requiredAndAuto" name="requiredAndAuto" required="true" type="java.lang.Boolean"/>
<xml-attribute java-attribute="AutoButNotRequired" name="AutoButNotRequired" type="java.lang.Boolean"/>
<xml-attribute java-attribute="withminandmax" name="withminandmax" type="java.lang.Boolean"/>
<xml-attribute java-attribute="allowedValue" name="allowedValue" type="java.lang.Boolean"/>
<xml-attribute java-attribute="allowedWithDefault" name="allowedWithDefault" type="java.lang.Boolean"/>
</java-attributes>
</java-type>
</java-types>
</xml-bindings>
Demo
Below is a simplified version of the bootstrap code:
package el520540;
import java.util.*;
import org.eclipse.persistence.jaxb.JAXBContextProperties;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
public class Demo {
public static void main(String[] args) throws Exception {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, "el520540/oxm.xml");
DynamicJAXBContextFactory.createContextFromOXM(Demo.class.getClassLoader(), properties);
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.02556 seconds