当前位置: 动力学知识库 > 问答 > 编程问答 >

java - not-null property references a null or transient value: in.nic.taphc.hc.protocol.persistence.Court.stateCode on save method of session object

问题描述:

Court.hbm.xml

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="in.nic.taphc.hc.protocol.persistence.Court" table="dir_court">

<id name="courtCode" type="int">

<column name="court_cd" />

<generator class="identity" />

</id>

<property name="courtTypeName" type="string">

<column name="court_nm" length="30" not-null="true" />

</property>

<property name="stateCode" type="int">

<column name="state_cd" length="100" not-null="true" />

</property>

</class>

</hibernate-mapping>

State.hbm.xml

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

<class name="in.nic.taphc.hc.protocol.persistence.State" table="dir_state_ut">

<id name="stateCode" type="int">

<column name="state_cd" />

</id>

<property name="stateName" type="string">

<column name="state_nm" length="30" not-null="true" />

</property>

</class>

</hibernate-mapping>

In State Table there is one primary key for state_cd column and in Court Table there is combinated primary keys for court_cd and state_cd

分享给朋友:
您可能感兴趣的文章:
随机阅读: