-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: java.lang.IllegalArgumentExcetption(id to load is required )
PostPosted: Fri Feb 03, 2006 12:34 am 
Newbie

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


Top
 Profile  
 
 Post subject: Re: java.lang.IllegalArgumentExcetption(id to load is requir
PostPosted: Wed Feb 08, 2006 8:41 am 
Beginner
Beginner

Joined: Mon Jan 30, 2006 2:28 am
Posts: 47
Location: INDIA
Hello,

Pls try to check your mapping files(hbm.xml) column names and db column names and datatype should be same.

_________________
A.Edward Durai
"The things which are impossible with men are possible with God."


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.