Joined: Thu Feb 02, 2006 11:37 pm Posts: 2
|
hi everbody, I am facing a problem explained below:
I have two classes CodeType.java and CodeTypeDisplay.java
The relationship between two is one to many from CodeType to CodeTypeDisplay.
CodeType.java
public class CodeType extends DSTBaseBusinessClass {
private String typeCode;
private Boolean hideIndicator;
private Boolean editIndicator;
private Boolean deleteIndicator;
private CodeGroup codeGroup;
private Set codeTypeDisplay ;
//getters and setters
}
CodeTypeDisplay.java
public class CodeTypeDisplay extends DSTBasePersistentClass {
private String displayText;
private CodeTypeDisplayKey codeTypeDisplayKey;
}
CodeTypeDisplayKey.java
public class CodeGroupDisplayKey implements Serializable {
private String languageCode;
private String codeGroupCode;
}
DSTBaseBusinessClass.java
public class DSTBaseBusinessClass implements Serializable {
private String dstBaseId;
private String createUserCode;
private String updateUserCode;
private Date createDate;
private Date updateDate;
//getter setters
}
DSTBasePersistentClass.java
public class DSTBasePersistentClass implements Serializable {
private Date createDate;
private String createUserCode;
private Date updateDate;
private String updateUserCode;
//getter setters
}
CodeType.hbm.xml
<hibernate-mapping>
<class name="com.dst.fourx.model.establishmentModel.CodeType" table="CODE_TYPE">
<id name="dstBaseId" type="string" unsaved-value="null">
<column name="CD_TYP_ID" length="50" />
<generator class="uuid.hex" />
</id>
<property name="createDate" type="timestamp" column="CREATE_DT" />
<property name="createUserCode" type="string" column="CREATE_USER_CD" />
<property name="updateDate" type="timestamp" column="LAST_MOD_DT" />
<property name="updateUserCode" type="string" column="LAST_MOD_USER_CD" />
<property name="hideIndicator" column="HIDE_IND" type="boolean"/>
<property name="editIndicator" column="EDIT_IND" type="boolean"/>
<property name="deleteIndicator" column="DEL_IND" type="boolean"/>
<property name="typeCode" column="CD_TYP_CD" type="string"/>
<many-to-one name="codeGroup" class="com.dst.fourx.model.establishmentModel.CodeGroup" column="CD_GRP_CD"/>
<set name="codeTypeDisplay" inverse="true" cascade="all" lazy="false">
<key column="OBJECT_ID"/>
<one-to-many class="com.dst.fourx.model.establishmentModel.CodeTypeDisplay" />
<filter name="languageFilter" condition="LANG_CD = :languageCode" />
</set>
</class>
<query name="findAllCodeTypesForGroup">
<![CDATA[from CodeType ctype where ctype.codeGroup.groupCode = :groupCode]]>
</query>
<filter-def name="languageFilter">
<filter-param name="languageCode" type="string" />
</filter-def>
</hibernate-mapping>
CodeTypeDisplay.hbm.xml
<hibernate-mapping>
<class name="com.dst.fourx.model.establishmentModel.CodeTypeDisplay" table="CODE_TYPE_DISPLAY">
<composite-id name="codeTypeDisplayKey" class="com.dst.fourx.model.establishmentModel.CodeTypeDisplayKey" unsaved-value="none">
<key-many-to-one name="codeTypeId" class="com.dst.fourx.model.establishmentModel.CodeType" column="OBJECT_ID" />
<key-property name="languageCode" column="LANG_CD" type="string"/>
</composite-id>
<property name="createDate" type="timestamp" column="CREATE_DT" />
<property name="createUserCode" type="string" column="CREATE_USER_CD" />
<property name="updateDate" type="timestamp" column="LAST_MOD_DT" />
<property name="updateUserCode" type="string" column="LAST_MOD_USER_CD" />
<property name="displayText" column="DISPLAY_TXT" type="string" />
</class>
</hibernate-mapping>
When I try to update my set by writing the following code:
session.update(codeType);// codeType is the object that contains the set (of elements from CodeTypeDisplay whose displayText field is changed)
then i get this exception: java.lang.IllegalArgumentExcetption - id to load is required for loading
PLEASE GIVE YOUR COMMENTS...
Thanks for viewing...
Narinder Singh
|
|