hibernate笔记 570页

cascading: Further  note  that  delete-orphan isn’t included in all.

 

<class name="Category" table="CATEGORY">
    ...
    <property name="name" column="CATEGORY_NAME"/>
    <many-to-one name="parentCategory"
                 class="Category"
                 column="PARENT_CATEGORY_ID"
                 cascade="none"/>
    <set name="childCategories"
         table="CATEGORY"
         cascade="save-update"
         inverse="true">
        <key column="PARENT_CATEGORY_ID"/>
        <one-to-many class="Category"/>
    </set>
    ...
</class>
This is a recursive bidirectional one-to-many association.

 

You use object/relational mapping to move data into the application tier so that you can use an object-oriented programming language to process that data. This is a good strategy if you’re implementing a multiuser online transaction processing application, with small to medium size data sets involved in each unit of work.  On the other hand, operations that require massive amounts of data are best not executed in the application tier.

 

With HQL, however, you can increment the version number of directly modified entity instances:
Query q =
   session.createQuery( "update versioned Item i set i.isActive = :isActive" );

你可能感兴趣的:(Hibernate,职场,笔记,休闲)