XML : JAXB class containing either a Element or Value saving with JPA to myql datbase

Hi I am unmarshalling a xml file and run into a problem. I created a two classes that extrect from my attribute class and using:

  @XmlWrapper(name="attributes")  @XmlElements({  @XmlElement(name="attribute", type=SingleAttribute.class),  @XmlElement(name="attribute", type=MultiAttribute.class)  })  List<Attribute> attributes;    

this unmarshal to a object just fine but when I want to save it to a database with JPA 2.0. I get a error that the type is unknown. Below the xml:

  <attributes>  <attribute name="att1">10</attribute>  <attribute name="att2">20</attribute>  <attribute name="att3">  <value>10</value>  <value>33</value>  <value>55</value>  </attribute>  <attribute name="att4">40</attribute>  </attributes>    

I am not behind my working computer but when I am I wil post the full stacktrace.

No comments:

Post a Comment