Hi,
I have a schema fragment that looks like
<xs:element name="dataValue">
<xs:complexType>
<xs:sequence>
<xs:element name="value" type="xs:anyType"\>
</xs:sequence>
</xs:complexType>
</xs:element>
The class produced by hyperjaxb3 contains the following fragment:
@XmlElement(required = true)
protected Object value;
@Transient
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@Basic
@Column(name = "VALUEOBJECT")
public String getValueObject() {
if (JAXBContextUtils.
isMarshallable("org.lcogt.schema", this.getValue())) {
return JAXBContextUtils.unmarshall("org.lcogt.schema", this.getValue());
} else {
return null;
}
}
I understand that hibernate will struggle to persist a pure Object so hyperjaxb is assuming that the object can be unmarshalled to a XML string and the resultant String is persisted. In my case this is not true but I can guarantee that the toString() method will return something useful. I would like the generated code to look more like:
@XmlElement(required = true)
protected Object value;
@Transient
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
@Basic
@Column(name = "VALUEOBJECT")
public String getValueObject() {
return value.toString();
}
Is there anyway I can get this effect or something similar?
Thanks,
Mark.