Beginner |
|
Joined: Fri May 11, 2007 11:03 am Posts: 32
|
Hi,
Im getting weird error.
I have a many-to-one relationship(unidirectional) between two classes(say A-B).
Now when I try to retrieve records from the many side I can retrieve the records with no problem.
One more thing to be mentioned here is that its 1-0 relationship. that means,
for a particular row in A there might be 0 or 1 row in B.
Also I have set cascading property as "none" in A.
Now when I try to update the row which I retrieved from A(one which had retireved null value for B) it tries to update the null value. and throws me a transient Object Exception.
Why should It even try to update the child table(B) when cascading has been set to none.
the mapping s are :
for class A:
<class name="A" table="A" lazy="false" batch-size="20" select-before-update='true' dynamic-update='true' >
<id name="id" column="ID">
<generator class="increment"/>
</id>
<many-to-one name="b_id" column="bid" class="B" not-found='ignore'
cascade="none" lazy="false" not-null="false" unique="false" />
</class>
for class B:
<class name="B" table="B" lazy="true" batch-size="10" select-before-update='true'>
<cache usage="read-write"/>
<id name="id" column="B_ID" >
<generator class="assigned"/>
</id>
<property name="progd" column="GROUPD" unique="true"/>
</class>
I fail to understand the reason......
|
|