手册页上是这么写的,相反的在one方是不行的,也可能是我记错了!!!!:)

解决方案 »

  1.   

    报什么错?
    many side不用设置什么,只要ONE方设置好了,级联就可以实现了
    inverse="true" lazy="true" 
    我使的时间也不短了,一直没出过错误的,如果不行,就把inverse打成false
      

  2.   

    我的双向一对多就没能实现级联存储,全是我手动存储的,无论我在那一方设置都不能实现级联存储,但查询结果却证实确实关联起来了,我详细说一下,class person---one方,class child---many方,person 有一个 list 全是child , child 有一个person ,就是这样的关系!Child.hmp.xml : <hibernate-mapping>
    <class
    name="com.weixin.Child"
    table="CHILD">
    <id
    name="C_id"
    column="CID">
    <generator class="increment"/> <!--identity increment uuid.hex -->
    </id>      
    <property name="name" type="string">
       <column name="NAME" length="100" not-null="false" />
    </property>
    <many-to-one name="person" class="com.weixin.Person" cascade="none" outer join="auto" update="true" insert="true" access="property" column="P_id"  not-null="false"/></class>
    </hibernate-mapping>person.hbm.xml : <hibernate-mapping>
    <class name="com.weixin.Person" table="PERSON" dynamic-update="true" dynamic-insert="true">
    <id name="P_id" column="PID">
    <generator class="increment" >
    <param name="property">child</param>
    </generator>
    </id>
    <property name="name" column="NAME"/>
    <list name="childs" table="child" lazy="false" inverse="false" cascade="all" >
    <key column="P_id" >
    </key>
    <index column="list_index" />
     <one-to-many class="com.weixin.Child" />
    </list>
    </class>
    </hibernate-mapping>
    child 是我在for里面一次一次的存储的,无法实现级联!!!:(  仁兄帮帮我!多谢!
      

  3.   

    一般cascade="all"中有inverse=true;父类还是子类如果设置inverse=true,表示主动方在没有设置该选项方。你再试试。