I've got a parent/child relationship where both tables/classes have a composite ID.
Both of the objects can be queried individually w/o error but I have problems when I try to create the parent/child relationship in the mapping.
I am getting this exception message:
Code:
11:25:50,154 INFO Configuration:468 - Reading mappings from resource: PactsSalesHeader.hbm.xml
11:25:50,184 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(25) Attribute "insert" must be declared for element type "column".
11:25:50,195 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(25) Attribute "update" must be declared for element type "column".
11:25:50,245 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(26) Attribute "insert" must be declared for element type "column".
11:25:50,245 ERROR XMLHelper:61 - Error parsing XML: XML InputStream(26) Attribute "update" must be declared for element type "column".
11:25:50,245 ERROR HibernateUtil:79 - Building SessionFactory failed.
org.hibernate.MappingException: Could not read mappings from resource: PactsSalesHeader.hbm.xml
However, I've done what it is telling me to do...as you can see below in my mapping files...
parent:
Code:
<hibernate-mapping>
<class
name="PactsSalesHeader"
proxy="PactsSalesHeader"
table="pa_invhdrp">
<composite-id name="Id" class="PactsSalesHeaderId">
<key-property name="InvoiceNumber" column="ihinvno" />
<key-property name="CompanyCode" column="comcode" />
</composite-id>
<property name="BranchId" column="brid"/>
<property name="DateCreated" column="ihcrtdte"/>
<property name="InvoiceTotal" column="ihinvtot"/>
<bag
name="Branches"
table="pa_branchp"
inverse="true"
lazy="true"
fetch="select"
cascade="none">
<key>
<column name="brid" insert="false" update="false" />
<column name="comcode" insert="false" update="false" />
</key>
<one-to-many class="PactsBranch" />
</bag>
</class>
</hibernate-mapping>
child:
Code:
<hibernate-mapping>
<class
name="PactsBranch"
proxy="PactsBranch"
table="pa_branchp">
<composite-id name="Id" class="PactsBranchId">
<key-property name="BranchId" column="brid" />
<key-property name="CompanyCode" column="comcode" />
</composite-id>
<property name="Name" column="brname"/>
<many-to-one
name="Header"
insert="false"
update="false"
class="PactsSalesHeader">
<column name="ihinvno" insert="false" update="false" />
<column name="comcode" insert="false" update="false" />
</many-to-one>
</class>
</hibernate-mapping>
Where do I go from here? I could not find a post in the forums that would clear this issue up for me...and I'm following the exact instructions from Hibernate In Action on how to do this...yet something is wrong.
Please advise! Thanks!
Hibernate version: 3.1
Name and version of the database you are using: MSSQL 2000