下面这个方法查询超时,这是为什么??
@SuppressWarnings("unchecked")
public List<Customer> findAllUseJoin() {
DetachedCriteria criteria = DetachedCriteria.forClass(Customer.class);
criteria.setFetchMode("nodeGroups",FetchMode.JOIN);
criteria.setFetchMode("nodes",FetchMode.JOIN);
criteria.setFetchMode("users",FetchMode.JOIN);
criteria.setFetchMode("usergroups",FetchMode.JOIN);
criteria.setFetchMode("collectorInfos",FetchMode.JOIN);
criteria.setFetchMode("customers",FetchMode.JOIN);
criteria.setFetchMode("mailClients",FetchMode.JOIN);
return getHibernateTemplate().findByCriteria(criteria);
}
Customer的定义如下:<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.dnt.svm.data.ac.Customer" table="ac_customer">
<id name="customerId" type="java.lang.Integer">
<column name="customer_id"/>
<generator class="com.dnt.svm.util.XAssigned"></generator>
</id>
<many-to-one name="customer" class="com.dnt.svm.data.ac.Customer" fetch="select" lazy="false">
<column name="parent_customer_id" />
</many-to-one>
<property name="orgId" type="java.lang.String">
<column name="org_id" length="32" not-null="true" unique="true" />
</property>
<property name="contractNo" type="java.lang.String">
<column name="contract_no" length="50" not-null="true" unique="true" />
</property>
<property name="customerName" type="java.lang.String">
<column name="customer_name" length="45" not-null="true" />
</property>
<property name="customerFullname" type="java.lang.String">
<column name="customer_fullname" />
</property>
<property name="customerContact" type="java.lang.String">
<column name="customer_contact" length="16" />
</property>
<property name="customerDes" type="java.lang.String">
<column name="customer_des" length="45" />
</property>
<property name="customerType" type="java.lang.String">
<column name="customer_type" length="45" />
</property>
<property name="customerLegal" type="java.lang.String">
<column name="customer_legal" />
</property>
<property name="customerAddress" type="java.lang.String">
<column name="customer_address" />
</property>
<property name="customerPhone" type="java.lang.String">
<column name="customer_phone" length="20" />
</property>
<property name="customerFax" type="java.lang.String">
<column name="customer_fax" length="20" />
</property>
<property name="customerZip" type="java.lang.String">
<column name="customer_zip" length="10" />
</property>
<property name="customerReserve1" type="java.lang.String">
<column name="customer_reserve1" length="45" />
</property>
<property name="customerReserve2" type="java.lang.String">
<column name="customer_reserve2" length="45" />
</property>
<property name="customerReserve3" type="java.lang.Integer">
<column name="customer_reserve3" />
</property>
<property name="customerSort" type="java.lang.Integer">
<column name="customer_sort"/>
</property>
<set name="customers" inverse="true" lazy="false">
<key>
<column name="parent_customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.ac.Customer" />
</set>
<set name="usergroups" inverse="true" lazy="false">
<key>
<column name="customerid" />
</key>
<one-to-many class="com.dnt.svm.data.ac.UserGroup" />
</set>
<set name="users" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.ac.User" />
</set>
<set name="nodeGroups" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.node.NodeGroup" />
</set>
<set name="mailClients" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.cfg.MailClient" />
</set>
<set name="nodes" inverse="true" lazy="false">
<key>
<column name="customer_id" not-null="true" />
</key>
<one-to-many class="com.dnt.svm.data.node.Node" />
</set>
<set name="collectorInfos" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.node.CollectorInfo" />
</set>
</class>
</hibernate-mapping>
hibernatefetchmodejoin超时
@SuppressWarnings("unchecked")
public List<Customer> findAllUseJoin() {
DetachedCriteria criteria = DetachedCriteria.forClass(Customer.class);
criteria.setFetchMode("nodeGroups",FetchMode.JOIN);
criteria.setFetchMode("nodes",FetchMode.JOIN);
criteria.setFetchMode("users",FetchMode.JOIN);
criteria.setFetchMode("usergroups",FetchMode.JOIN);
criteria.setFetchMode("collectorInfos",FetchMode.JOIN);
criteria.setFetchMode("customers",FetchMode.JOIN);
criteria.setFetchMode("mailClients",FetchMode.JOIN);
return getHibernateTemplate().findByCriteria(criteria);
}
Customer的定义如下:<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.dnt.svm.data.ac.Customer" table="ac_customer">
<id name="customerId" type="java.lang.Integer">
<column name="customer_id"/>
<generator class="com.dnt.svm.util.XAssigned"></generator>
</id>
<many-to-one name="customer" class="com.dnt.svm.data.ac.Customer" fetch="select" lazy="false">
<column name="parent_customer_id" />
</many-to-one>
<property name="orgId" type="java.lang.String">
<column name="org_id" length="32" not-null="true" unique="true" />
</property>
<property name="contractNo" type="java.lang.String">
<column name="contract_no" length="50" not-null="true" unique="true" />
</property>
<property name="customerName" type="java.lang.String">
<column name="customer_name" length="45" not-null="true" />
</property>
<property name="customerFullname" type="java.lang.String">
<column name="customer_fullname" />
</property>
<property name="customerContact" type="java.lang.String">
<column name="customer_contact" length="16" />
</property>
<property name="customerDes" type="java.lang.String">
<column name="customer_des" length="45" />
</property>
<property name="customerType" type="java.lang.String">
<column name="customer_type" length="45" />
</property>
<property name="customerLegal" type="java.lang.String">
<column name="customer_legal" />
</property>
<property name="customerAddress" type="java.lang.String">
<column name="customer_address" />
</property>
<property name="customerPhone" type="java.lang.String">
<column name="customer_phone" length="20" />
</property>
<property name="customerFax" type="java.lang.String">
<column name="customer_fax" length="20" />
</property>
<property name="customerZip" type="java.lang.String">
<column name="customer_zip" length="10" />
</property>
<property name="customerReserve1" type="java.lang.String">
<column name="customer_reserve1" length="45" />
</property>
<property name="customerReserve2" type="java.lang.String">
<column name="customer_reserve2" length="45" />
</property>
<property name="customerReserve3" type="java.lang.Integer">
<column name="customer_reserve3" />
</property>
<property name="customerSort" type="java.lang.Integer">
<column name="customer_sort"/>
</property>
<set name="customers" inverse="true" lazy="false">
<key>
<column name="parent_customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.ac.Customer" />
</set>
<set name="usergroups" inverse="true" lazy="false">
<key>
<column name="customerid" />
</key>
<one-to-many class="com.dnt.svm.data.ac.UserGroup" />
</set>
<set name="users" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.ac.User" />
</set>
<set name="nodeGroups" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.node.NodeGroup" />
</set>
<set name="mailClients" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.cfg.MailClient" />
</set>
<set name="nodes" inverse="true" lazy="false">
<key>
<column name="customer_id" not-null="true" />
</key>
<one-to-many class="com.dnt.svm.data.node.Node" />
</set>
<set name="collectorInfos" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="com.dnt.svm.data.node.CollectorInfo" />
</set>
</class>
</hibernate-mapping>
hibernatefetchmodejoin超时
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货