org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling

Hi
I am facing a problem with the Hibernate framework.
I have a parent table and associate child table
When I try to insert a record to the Parent it is not inserting the record to the child.It is getting inserted to the parent.
I am not getting any exception also
I am using sesson.save(parent object).

do I need to explicitly do session.save(child object)?
mapping xml for the parent

<hibernate-mapping package="com.ert.nwcs.symbology.dataaccess">
<class name="TbNewsCode" table="TB_NEWS_CODE" schema="NWCS">
<id name="newsCodeId" type="big_decimal">
<column name="NEWS_CODE_ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="newsCode" type="string">
<column name="NEWS_CODE" length="10" not-null="true" />
</property>
<property name="newsType" type="big_decimal">
<column name="NEWS_TYPE" precision="22" scale="0" not-null="true" />
</property>
<set name="tbNewsCodeChild" inverse="true" >
<key>
<column name="NEWS_CODE_ID" precision="22" scale="0" not-null="true" />
</key>
<one-to-many class="TbNewsCodeChild" />
</set>
</class>
</hibernate-mapping>

mapping xml for child

<hibernate-mapping package="com.ert.nwcs.symbology.dataaccess">
<class name="TbNewsCodeParent" table="TB_NEWS_CODE_CHILD" schema="NWCS">
<composite-id name="id" class="TbNewsCodeChildId">
<key-many-to-one name="tbNewsCode" class="TbNewsCode">
<column name="NEWS_CODE_ID" precision="22" scale="0" />
</key-many-to-one>
<key-property name="childCode" type="string">
<column name="CHILD_CODE" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>

Please help me resolve this problem.
I tried using cascade="all" or cascade ="save-update" option in the parent mapping xml, but it is giving me some error when it tries to access the getter method of child

 

------------------------------------solution----------------------------------------------------------------------------

 

Hi All,
I was able to solve the problem
my parent object set contained the string attibutes which actually should have contained the child objects.

你可能感兴趣的:(Hibernate)