Joined: Tue Aug 02, 2005 1:54 pm Posts: 2
|
My original problem was that when performing a save() on my child object, it kept trying to UPDATE instead of INSERT. So I thought the issue might be solved by placing parent/child parameters in my XML files. I'm now getting an error that my XML is mapped incorrectly. Any help?
--------PARENT-----------
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.bkv.search.objectmodel.Keyword" table="Keywords">
<composite-id>
<key-many-to-one name="client" class="com.bkv.search.objectmodel.Client" column="clientName"/>
<key-property name="keywordName"/>
</composite-id>
<set name="keywordBuy" table="KeywordBuys" lazy="false" cascade="all" inverse="true" >
<key column="keywordName"/>
<key column="clientName" />
<one-to-many class="com.bkv.search.objectmodel.KeywordBuy"/>
</set>
<property name="groupName"/>
<many-to-one name="department" class="com.bkv.search.objectmodel.Department" column="deptName"/>
<property name="campaign"/>
<many-to-one name="category" class="com.bkv.search.objectmodel.Category" column="categoryName"/>
</class>
</hibernate-mapping>
--------------CHILD--------------------------
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.bkv.search.objectmodel.KeywordBuy" table="KeywordBuys">
<id name="buyId">
<generator class="increment"/>
</id>
<property name="buyTime"/>
<property name="campaign"/>
<property name="url"/>
<many-to-one name="keyword" class="com.bkv.search.objectmodel.Keyword" not-null="true">
<column name="clientName"/>
<column name="keywordName"/>
</many-to-one>
<many-to-one name="searchEngine" class="com.bkv.search.objectmodel.SearchEngine" insert="false" update="false">
<column name="clientName" />
<column name="searchEngineName"/>
</many-to-one>
<many-to-one name="matchType" class="com.bkv.search.objectmodel.MatchType" column="matchTypeName"/>
<many-to-one name="placement" class="com.bkv.search.objectmodel.Placement" column="placementName"/>
<many-to-one name="status" class="com.bkv.search.objectmodel.Status" column="statusName"/>
</class>
</hibernate-mapping>
|
|