《Mysql實例mySQL 延遲 查詢主表》要點:
本文介紹了Mysql實例mySQL 延遲 查詢主表,希望對您有用。如果有疑問,可以聯(lián)系我們。
例:
代碼如下:
<hibernate-mapping>
<class name="com.pojo.Sortp" table="sortp" catalog="shjdc">
<id name="id" type="java.lang.Integer">
<column name="Id" />
<generator class="assigned" />
</id>
<property name="name" type="java.lang.String">
<column name="Name" length="40" not-null="true" />
</property>
<set name="productses" inverse="true" cascade="all" lazy="true">
<key>
<column name="Sortid" not-null="true" />
</key>
<one-to-many class="com.pojo.Products" />
</set>
</class>
</hibernate-mapping>
一般情況下就是把lazy設為true,而不是false,因為,假如設為false的話,在執(zhí)行查詢主表的同時,相應的子表也會查詢,添加了許多無用功.
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/3625.html