日期:2014-05-17  浏览次数:20722 次

新人问个关于hibernate中的一小问题~请指点下~~
我要建3张表比如order,product,orderlist3张表,orderlist是product和order的关系表。orderlist中的PID和OID分别是另外2张表的主键,还有一个address和count。现在我映射到hibernate中。
orderlist的配置文件
<hibernate-mapping>
  <class name="entity.Orderlist" table="ORDERLIST" schema="HR">
  <id name="olid" type="java.lang.Integer">
  <column name="OLID" precision="22" scale="0" />
  <generator class="native" />
  </id>
  <property name="pid" type="java.lang.Integer">
  <column name="PID" precision="22" scale="0" />
  </property>
  <property name="oid" type="java.lang.Integer">
  <column name="OID" precision="22" scale="0" />
  </property>
  <property name="address" type="java.lang.String">
  <column name="ADDRESS" length="150" />
  </property>
  <property name="ocount" type="java.lang.Integer">
  <column name="OCOUNT" precision="22" scale="0" />
  </property>
  </class>
</hibernate-mapping>
但是我现在插入数据发现问题,我插入一条数据的时候,这张表会分2个显示。。
PID OID OLID ADDRESS OCOUNT 
- - 180 shanghai 3 
179 178 181 - -  
求指点下,这是什么问题额~~

------解决方案--------------------
映射时候是不是三张表一起的?
------解决方案--------------------
应该映射关系 没有建立好吧