=======line.hbm.xml=======
<hibernate-mapping>
   <class name="fatcat.db.Line" table="line">
      <id name="bh" type="java.lang.Integer">
          <column name="bh" length="30">
<comment>编号</comment>
</column>
          <generator class="assigned" />
      </id>
     <property name="lineName" type="java.lang.String">
<column name="line_name" length="250">
<comment>线路名称</comment>
</column>
 </property>
      
<!-- 主键一对一 -->
      <one-to-one name="LineDetail"  class="fatcat.db.LineDetail"  cascade="all" outer-join="true" />
   </class>
</hibernate-mapping>=======LineDetail.hbm.xml=======<hibernate-mapping>
<class name="fatcat.db.LineDetail" table="line_detail"> <id name="line_bh">
<column name="line_bh">
<comment>编号</comment>
</column>
<generator class="foreign">
<param name="property">Line</param>
</generator>
</id> <property name="content" type="java.lang.String">
<column name="content" length="2147483647">
<comment>内容</comment>
</column>
</property> <one-to-one name="Line" class="fatcat.db.Line" constrained="true"/> </class>
</hibernate-mapping>
==========保存action========
Line line = new Line();
line.setBh(2);
line.setLineName("广西桂林");
LineDetail line_detail = new LineDetail();
line_detail.setContent("游玩");

//相互关联
line_detail.setLine(line);
line.setLineDetail(line_detail);
this.line_service.save_all(line);============实现==============
public void save_all(Line line){
sessionFactory.getCurrentSession().saveOrUpdate(line);
}
我上面的这段代码只能新增,不能更新,请大家帮忙看看如何实现在有这条记录存在数据库时就更新,没有记录时就插入呢?