hibernate lazy cascade属性
<hibernate-mapping> <class name="cn.itcast.nsfw.role.entity.role" table="role"> <id name="roleid" type="java.lang.String"> <column name="role_id" length="32" /> <generator class="uuid.hex" /> </id> <property name="name" type="java.lang.String"> <column name="name" length="20" not-null="true" /> </property> <property name="state" type="java.lang.String"> <column name="state" length="1" /> </property> <set name="roleprivileges" inverse="true" lazy="false" cascade="save-update,delete"> <key> <column name="role"></column> </key> <one-to-many class="cn.itcast.nsfw.role.entity.roleprivilege"/> </set> </class> </hibernate-mapping>
lazy=true ; 是对关联的类 不自动加载 类的属性; lazy=false 是将关联的类的属性自动加载
cascade 级联 更新 级联保存 级联删除!