hibernate many to relationship
i would like to maintain many to one relationship with two table on the database. I am using Oracle database and Hibernate. The tables are application and instrument . first one has two column : id and event. second table has three column : id, type and application . the hibernate mapping for application is like :
<class name="com.tpdadmin.entity.Application" table="tpd_application_table">
<id name="id" column="id" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">tpd_application_table_sequence</param>
</generator>
</id>
<property name="event" column="event" type="java.lang.String" />
</class>
And for instrument is like :
<class name="com.tpdadmin.entity.Instrument" table="tpd_instrument">
<id name="id" column="id" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">tpd_instrument_sequence</param>
</generator>
</id>
<property name="type" column="type" type="java.lang.String" />
<many-to-one name="applicationTable" class="com.tpdadmin.entity.Application" column="application_table_id" insert="false" update="false" />
</class>
i want to maintain relationship between these two entities. but with these hibernate mapping, i am not able to make their relationship. so guys please help me out.
链接地址: http://www.djcxy.com/p/63682.html上一篇: 休眠员工和国家的一对一映射
下一篇: 冬眠许多关系