有3张表相关联, 我在关联插入数据的时候,出现问题! 例如:ground表,groundType表,product表。
我操作插值的时候, ground与groundType之间在数据库中 主外键能体现出来,但是product这种表不能体现出groundType的主外键!
grt.getgroundSet().add(gr);我是这样关联groundType与product的 主外键的。
我操作插值的时候, ground与groundType之间在数据库中 主外键能体现出来,但是product这种表不能体现出groundType的主外键!
grt.getgroundSet().add(gr);我是这样关联groundType与product的 主外键的。
<class name="com.pxcs.model.GroundType" table="t_groundType"> <id name="id" column="id" type="int">
<generator class="native" />
</id>
<property name="groundTypeName" column="groundTypeName" type="string"></property>
<set name="grounds" table="t_trainGround" inverse="true" cascade="delete">
<key column="fk_gtid"></key>
<one-to-many class="com.pxcs.model.TrainGround"/>
</set>
</class>
</hibernate-mapping>
这是 groundType这张表的体现
<subclass name="com.pxcs.model.TrainGround" discriminator-value="GROUND">
<join table="t_trainGround" fetch="select">
<key column="PAYMENT_ID"/>
<property name="seatNum" column="seatNum" type="string"></property>
<property name="address" column="address" type="string"></property>
<property name="startDate" column="startDate" type="string"></property>
<property name="endDate" column="endDate" type="string"></property>
<many-to-one name="groundType" class="com.pxcs.model.GroundType" column="fk_gtid" ></many-to-one>
</join>
</subclass>
这是 product这张表的体现
然后在实现业务的时候用 A.id=B.id这种。