mySQL delays querying the main table
- 2020-05-09 19:27:17
- OfStack
Ex. :
1 normally, lazy is set to true instead of false, because if false is set to false, the main table will be queried at the same time as the corresponding subtable, adding a lot of idle work.
<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>
1 normally, lazy is set to true instead of false, because if false is set to false, the main table will be queried at the same time as the corresponding subtable, adding a lot of idle work.