Hey,
      
      I'm trying to enable xml validation using moxy, which works
      alright. Except that displaying a bunch of inter-referenced
      objects on the same document means using the @XmlKey and
      @XmlJoinNode annotations (since ids can and definitely will
      collide, so xs:id is out of question).
      And came across this:
      
Exception Description: The property or field key must be an attribute because another field or property is annotated with XmlValue.
 - with linked exception:
[Exception [EclipseLink-50010] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The property or field key must be an attribute because another field or property is annotated with XmlValue.]
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:832)
	at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:143)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:142)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:129)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:93)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:83)
	...
Caused by: Exception [EclipseLink-50010] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The property or field key must be an attribute because another field or property is annotated with XmlValue.
	at org.eclipse.persistence.exceptions.JAXBException.propertyOrFieldShouldBeAnAttribute(JAXBException.java:233)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:763)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:237)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147)
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:829)
	... 17 more
but, it IS an attribute:
      public class VOEntryType {
          @XmlJoinNode(referencedXmlPath = "@id", xmlPath = "@id")
    public Opcion key; 
    @XmlValue
    public Integer value;
}
      
      (Yep, entrytype, because this is being used in an Adapter from map
      to list)
      
      Now, trying annotating it like this (which looks weird):
      
         @XmlAttribute
         @XmlJoinNode(referencedXmlPath = "@id", xmlPath
        = "@id")
          public Opcion key; 
      
      Gets me a different exception (which without looking much into the
      code I guess is because there's a two/n-pass process going on, in
      which the xmlpath kind of annotations come last):
      
      java.lang.NullPointerException
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.buildSchemaComponentsForXPath(SchemaGenerator.java:1018)
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.addXmlJoinNodesToSchema(SchemaGenerator.java:2036)
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.addToSchemaType(SchemaGenerator.java:434)
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.populateSchemaTypes(SchemaGenerator.java:549)
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.generateSchema(SchemaGenerator.java:146)
	at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.generateSchema(SchemaGenerator.java:132)
	at org.eclipse.persistence.jaxb.compiler.Generator.generateSchemaFiles(Generator.java:209)
	at org.eclipse.persistence.jaxb.JAXBContext.generateSchema(JAXBContext.java:242)
	at org.eclipse.persistence.jaxb.JAXBContext.generateSchema(JAXBContext.java:215)
	...
      So, the question is, is using an @XmlValue in conjunction with a
      @XmlJoinNode annotation possible / are there any workarounds?
      
      p.s.: eclipselink-2.3.2.v20111125-r10461
      
      
      
      
      _______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users