Hi,
I am using Person.hbm.xml file,in that person manager is one of the type,
here personManage is many to one relation ship.while saving the person object without person manager i am getting nested excepetion org.hibernate.TransientObjectException.canaot save transiant variables.
here i am providing the select box to select manager type nad manager for the paticular person.but it is not saving without person manager.
plase help me to sort out this problem.here hbm file
<hibernate-mapping>
<class name="com.roche.demandomat.model.Person" table="PERSON">
<meta attribute="extends">
com.roche.demandomat.model.BaseEntity
</meta>
<meta attribute="class-code">
public static final Integer TYPE1=new Integer(1); public
static final Integer TYPE2=new Integer(2); public static
final Integer TYPE3=new Integer(3); public static final
Integer TYPE4=new Integer(4); public static final Integer
TYPE5=new Integer(5);
</meta>
<cache usage="read-write" />
<id name="id" column="PERSON_ID" type="java.lang.Long">
<generator class="native">
<param name="sequence">PERSON_SEQ</param>
</generator>
</id>
<property name="person_name" type="java.lang.String"
index="NAME_IDX">
<column name="PERSON_NAME" not-null="true" length="200" />
</property>
<property name="person_type" type="java.lang.Integer"
index="PERSON_TYPE_IDX">
<column name="PERSON_TYPE" />
</property>
<property name="valid" type="java.lang.String"
index="VALID_IDX">
<column name="VALID" length="1" />
</property>
<many-to-one name="personManager" class="com.roche.demandomat.model.Person"
not-null="false" lazy="false" fetch="join">
<column name="PERSON_MANAGER_FK" />
</many-to-one>
<many-to-one name="unit" class="com.roche.demandomat.model.Unit"
not-null="true" lazy="false" fetch="join">
<column name="UNIT_FK" />
</many-to-one>
<many-to-one name="role" class="com.roche.demandomat.model.Role"
not-null="true" lazy="false" fetch="join">
<column name="ROLE_FK" />
</many-to-one>
<set name="personService" cascade="all-delete-orphan"
inverse="true" lazy="true">
<key column="PERSON_FK"/>
<one-to-many class="com.roche.demandomat.model.PersonService"/>
</set>
<set name="persons" cascade="all-delete-orphan"
inverse="true" lazy="true">
<key column="PERSON_MANAGER_FK"/>
<one-to-many class="com.roche.demandomat.model.Person"/>
</set>
</class>
|