Hello,
I have used xdoclet to generate the following mappings with element array.
but when loading up the webapps, this exception is thrown:
Code:
01:42:02,413 ERROR XMLHelper:37 - Error parsing XML: XML InputStream(588)
org.xml.sax.SAXParseException: Attribute "inverse" must be declared for element
type "array".
Below is the portion of the hbm relevant to the array element.
Would you mind share some thoughts with me why there is such a problem?
Thanks.
Code:
<array
name="frontParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
Here is the full listing of the hbm file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="Sample"
table="sample"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="factoryId"
column="factoryId"
type="java.lang.Long"
>
<generator class="native">
</generator>
</id>
<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="description"
/>
<property
name="quantity"
type="int"
update="true"
insert="true"
column="quantity"
/>
<property
name="clientName"
type="java.lang.String"
update="true"
insert="true"
column="clientName"
/>
<property
name="clientModelNumber"
type="java.lang.String"
update="true"
insert="true"
column="clientModelNumber"
/>
<property
name="clientModel"
type="java.lang.String"
update="true"
insert="true"
column="clientModel"
/>
<property
name="requester"
type="java.lang.String"
update="true"
insert="true"
column="requester"
/>
<property
name="requestDate"
type="java.util.Calendar"
update="true"
insert="true"
column="requestDate"
/>
<property
name="estimatedWorkingDay"
type="int"
update="true"
insert="true"
column="estimatedWorkingDay"
/>
<property
name="actualCompletionDate"
type="java.util.Calendar"
update="true"
insert="true"
column="actualCompletionDate"
/>
<property
name="remark"
type="java.lang.String"
update="true"
insert="true"
column="remark"
/>
<array
name="frontParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="backParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="laceParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="bowParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="accessoryParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="headRubberParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="footRubberParts"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<composite-element
class="ClothPart"
>
<property
name="materialName"
type="java.lang.String"
update="true"
insert="true"
column="materialName"
/>
<property
name="supplier"
type="java.lang.String"
update="true"
insert="true"
column="supplier"
/>
<property
name="sewingMethod"
type="java.lang.String"
update="true"
insert="true"
column="sewingMethod"
/>
<property
name="costPerUnit"
type="float"
update="true"
insert="true"
column="costPerUnit"
/>
<property
name="numberOfUnitUsed"
type="float"
update="true"
insert="true"
column="numberOfUnitUsed"
/>
</composite-element>
</array>
<array
name="underWearRegionSizeLabels"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<element
column="label"
type="string"
not-null="false"
unique="false"
/>
</array>
<array
name="underWearRegionLabels"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<element
column="label"
type="string"
not-null="false"
unique="false"
/>
</array>
<array
name="underWearColorLabels"
inverse="true"
cascade="all"
>
<key
column="sampleId"
/>
<index
column="arrayIndex"
/>
<element
column="label"
type="string"
not-null="false"
unique="false"
/>
</array>
<component
name="underWearRegionSizeMatrix"
class="RegionMatrix"
>
<set
name="regionMatrixEntries"
lazy="false"
inverse="false"
cascade="save-update"
sort="unsorted"
>
<key
column="factoryId"
/>
<composite-element
class="Entry"
>
<property
name="i"
type="int"
update="true"
insert="true"
column="i"
/>
<property
name="j"
type="int"
update="true"
insert="true"
column="j"
/>
<property
name="value"
type="java.lang.String"
update="true"
insert="true"
column="value"
/>
</composite-element>
</set>
</component>
<component
name="underWearColorSizeMatrix"
class="ColorMatrix"
>
<set
name="colorMatrixEntries"
lazy="false"
inverse="true"
cascade="all"
sort="unsorted"
>
<key
column="factoryId"
/>
<composite-element
class="Entry"
>
<property
name="i"
type="int"
update="true"
insert="true"
column="i"
/>
<property
name="j"
type="int"
update="true"
insert="true"
column="j"
/>
<property
name="value"
type="java.lang.String"
update="true"
insert="true"
column="value"
/>
</composite-element>
</set>
</component>
<component
name="paperTemplate"
class="PaperTemplate"
>
<property
name="paperTemplateNumber"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateNumber"
/>
<property
name="paperTemplateFrontweight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateFrontweight"
/>
<property
name="paperTemplateBackweight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateBackweight"
/>
<property
name="paperTemplateLaceweight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateLaceweight"
/>
<property
name="paperTemplateFrontUnitWeight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateFrontUnitWeight"
/>
<property
name="paperTemplateBackUnitWeight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateBackUnitWeight"
/>
<property
name="paperTemplateLaceUnitWeight"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateLaceUnitWeight"
/>
<property
name="paperTemplateFrontLength"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateFrontLength"
/>
<property
name="paperTemplateBackLength"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateBackLength"
/>
<property
name="paperTemplateLaceLength"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateLaceLength"
/>
<property
name="paperTemplateFrontWidth"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateFrontWidth"
/>
<property
name="paperTemplateBackWidth"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateBackWidth"
/>
<property
name="paperTemplateLaceWidth"
type="java.lang.String"
update="true"
insert="true"
column="paperTemplateLaceWidth"
/>
</component>
<property
name="imageFileName"
type="java.lang.String"
update="true"
insert="true"
column="imageFileName"
/>
<property
name="status"
type="Status"
update="true"
insert="true"
column="status"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Sample.xml
containing the additional properties and place it in your merge dir.
-->
<joined-subclass
name="DeployedSample"
dynamic-update="false"
dynamic-insert="false"
>
<key
column="deployedSampleId"
/>
</joined-subclass>
<joined-subclass
name="QuotationSample"
dynamic-update="false"
dynamic-insert="false"
>
<key
column="quotationSampleId"
/>
<property
name="originalFactoryId"
type="java.lang.Long"
update="true"
insert="true"
column="originalFactoryId"
/>
<property
name="artNumber"
type="java.lang.String"
update="true"
insert="true"
column="artNumber"
/>
<property
name="profit"
type="float"
update="true"
insert="true"
column="profit"
/>
<property
name="quotationDate"
type="java.util.Calendar"
update="true"
insert="true"
column="quotationDate"
/>
<property
name="quotationColor"
type="java.lang.String"
update="true"
insert="true"
column="quotationColor"
/>
<property
name="packagingComponent"
type="java.lang.String"
update="true"
insert="true"
column="packagingComponent"
/>
<property
name="packagingCost"
type="float"
update="true"
insert="true"
column="packagingCost"
/>
<property
name="transportationComponent"
type="java.lang.String"
update="true"
insert="true"
column="transportationComponent"
/>
<property
name="transportationCost"
type="float"
update="true"
insert="true"
column="transportationCost"
/>
<property
name="wageComponent"
type="java.lang.String"
update="true"
insert="true"
column="wageComponent"
/>
<property
name="wageCost"
type="float"
update="true"
insert="true"
column="wageCost"
/>
<property
name="factoryMiscComponent"
type="java.lang.String"
update="true"
insert="true"
column="factoryMiscComponent"
/>
<property
name="factoryMiscFee"
type="float"
update="true"
insert="true"
column="factoryMiscFee"
/>
<property
name="actualQuotation"
type="float"
update="true"
insert="true"
column="actualQuotation"
/>
</joined-subclass>
</class>
</hibernate-mapping>