Hello,
I'm trying to map a list of parameter sets for an application. Because we want to transfer them via WebServices, I defined them in a XSD.
Code:
...
<xsd:complexType name="ParameterListMetaData">
<xsd:sequence>
<xsd:element name="description" type="xsd:string" maxOccurs="1" minOccurs="0" />
...
</xsd:sequence>
<xsd:attributeGroup ref="base:Identifiable"></xsd:attributeGroup>
...
</xsd:complexType>
...
<xsd:complexType name="ParameterList">
<xsd:complexContent>
<xsd:extension base="this:ParameterListMetaData">
<xsd:sequence>
<xsd:element name="parameter-values" maxOccurs="unbounded" minOccurs="1" type="this:ParameterValues" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
...
<xsd:complexType name="ParameterValues">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="values" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
(It may seem strange that parameter lists contain of lists of value lists instead of complete name/value pairs, but it saves me to transmit redundant information as much as possible.)
So basically I have
A ParameterList which contains a list of ParameterValues
and
ParameterValues which contains a list of String.
Naturally the ParameterValues are no entities of their own and have no identifier property. I'd like them deleted when I delete the whole list and of course I'd like to be able to remove/manipulate entries from the list of ParameterValues.
The Java classes are generated with XJC so there are getters for the collections and I switched on the equals() and hashCode() extensions.
However, hibernate does seem to support collections of components (ParameterValues inside ParameterList) which themselves have collections of values (says the documentation Chapter 8.2 "Collections of dependent objects": "Composite elements may contain components but not collections.") and mapping the ParameterValues as a class causes an exception complaining that it does not define an identifier property.
Has anyone solved a similar problem without introducing an identifier property?