Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Name collision when using super-type in moxy oxm.xml
Name collision when using super-type in moxy oxm.xml [message #1104286] Sun, 08 September 2013 05:01 Go to next message
jason zhang is currently offline jason zhangFriend
Messages: 31
Registered: July 2009
Member
My oxm.xml like this.
<?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"/>
            <java-attribute java-attribute="Name" name="Name" required="true"/>
            <java-attribute java-attribute="Type" name="Type" required="true"/>
         </java-attributes>
      </java-type>
      <java-type name="ConditionQuery" super-type="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"/>
            <java-attribute java-attribute="DateCreated" name="DateCreated" required="true"/>
            <java-attribute java-attribute="DateModified" name="DateModified" required="true"/>
            <java-attribute java-attribute="defaultCase" name="defaultCase"/>
            <java-attribute java-attribute="withdefault" name="withdefault"/>
            <java-attribute java-attribute="requiredAndAuto" name="requiredAndAuto" required="true"/>
            <java-attribute java-attribute="AutoButNotRequired" name="AutoButNotRequired"/>
            <java-attribute java-attribute="withminandmax" name="withminandmax"/>
            <java-attribute java-attribute="allowedValue" name="allowedValue"/>
            <java-attribute java-attribute="allowedWithDefault" name="allowedWithDefault"/>
         </java-attributes>
      </java-type>
   </java-types>
</xml-bindings>



I got this exception
Local Exception Stack: 
Exception [EclipseLink-50007] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Name collision.  Two classes have the XML type with uri  and name typedQuery.
	at org.eclipse.persistence.exceptions.JAXBException.nameCollision(JAXBException.java:215)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processTypeQName(AnnotationsProcessor.java:1783)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildTypeInfo(AnnotationsProcessor.java:812)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.postBuildTypeInfo(AnnotationsProcessor.java:738)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildNewTypeInfo(AnnotationsProcessor.java:4668)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.postProcessXmlAccessorType(AnnotationsProcessor.java:1612)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildTypeInfo(AnnotationsProcessor.java:800)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.postBuildTypeInfo(AnnotationsProcessor.java:738)
	at org.eclipse.persistence.jaxb.compiler.XMLProcessor.processXML(XMLProcessor.java:363)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:104)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext$MetadataContextInput.createContextState(DynamicJAXBContext.java:236)
	at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:174)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.<init>(DynamicJAXBContext.java:71)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(DynamicJAXBContextFactory.java:347)


Actually, I am using code to generate XmlBindings. The xml shown above is dumped from XmlBindings java object.

My dynamicJaxbContext is created like this
Map<String, Object> properties = new HashMap<String, Object>(1); 
		properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, new MoxyMetaSource(types));

		ServerSession session = JpaHelper.getEntityManagerFactory(em).getServerSession();
		DynamicClassLoader dcl =DJPAHelper.getDcl(session);
		jaxbContext = 
			    DynamicJAXBContextFactory.createContextFromOXM(dcl, properties);


Here my DynamicType is created through DynamicJPA.
Did I do anything wrong with super-type? I do not see any name collision in my oxm.xml.

Thanks
Re: Name collision when using super-type in moxy oxm.xml [message #1106831 is a reply to message #1104286] Wed, 11 September 2013 15:59 Go to previous message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

See my reply here:
- http://www.eclipse.org/forums/index.php/mv/msg/520540/1106830/#msg_1106830
Previous Topic:how to remove xsd xsi xsi:type from generated xml element
Next Topic:Name collision when using super-type in moxy oxm.xml
Goto Forum:
  


Current Time: Thu Apr 25 23:29:47 GMT 2024

Powered by FUDForum. Page generated in 0.02876 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top