首页 新闻 赞助 找找看

ibatis查询几条数据,用时为何两三秒,请前辈们看一下

0
悬赏园豆:50 [已关闭问题] 关闭于 2011-11-04 14:37

User.java

private int uid;
private String uname;
private String upwd;
private List<Address> addressList=new ArrayList<Address>();
//----------------

Address.java

private int id;
private String address;
private String code;
private User user;
//---------------

sql-map-config.xml

//-----------
<sqlMapConfig>
<settings
cacheModelsEnabled="true"
enhancementEnabled
="true"
lazyLoadingEnabled
="true"
errorTracingEnabled
="true"
maxSessions
="1024"
maxTransactions
="512"
maxRequests
="2048"
useStatementNamespaces
="false" />

<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<!-- com.microsoft.sqlserver.jdbc.SQLServerDriver -->
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />
<!--jdbc:sqlserver://localhost:1433;databaseName=ibatisorm -->
<property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/ibatisorm" />
<property name="JDBC.Username" value="root" />
<property name="JDBC.Password" value="root" />
<property name="Pool.MaximumActiveConnections" value="10" />
<property name="Pool.MaximumIdleConnections" value="5" />
<property name="Pool.MaximumCheckoutTime" value="120000" />
<property name="Pool.TimeToWait" value="500" />
<property name="Pool.PingQuery" value="select 1 from TestDB" />
<property name="Pool.PingEnabled" value="false" />
<property name="Pool.PingConnectionsOlderThan" value="1" />
<property name="Pool.PingConnectionsNotUsedFor" value="1" />
</dataSource>
</transactionManager>

<sqlMap resource="sqlMap/User.xml" />
<sqlMap resource="sqlMap/Person.xml" />
</sqlMapConfig>
User.xml

<sqlMap namespace="User">
<resultMap id="result" class="com.tq365.vo.User">
<result property="uid" column="uid"></result>
<result property="uname" column="uname"></result>
<result property="upwd" column="upwd"></result>
<result property="addressList" column="uid" select="address.findByUid"></result>
</resultMap>
<resultMap id="address_result" class="com.tq365.vo.Address">
<result property="id" column="id"></result>
<result property="address" column="address"></result>
<result property="code" column="code"></result>
<result property="user" column="uid" select="findUserByID"></result>
</resultMap>
<cacheModel id="user-cache" type="LRU">
<flushInterval hours="24"/>
<flushOnExecute statement="insertUser"/>
<flushOnExecute statement="deleteUserByID"/>
<flushOnExecute statement="updateUserByUser"/>
<property name="size" value="1000"/>
</cacheModel>
//---------------------------
<!--分页查询部分 -->
<select id="findAllUserCount" resultClass="int">
select count(*) from t_user
</select>
<select id="findPageUser" parameterClass="int" resultMap="result" cacheModel="user-cache">
select * from t_user limit #start#,5
</select>

 

数据库中一共才8条记录,还是分页查询,为什么查一下用了两三秒,请前辈们详细告诉下,是什么原因,该怎样改配置文件

archie2010的主页 archie2010 | 菜鸟二级 | 园豆:205
提问于:2010-12-07 10:00
< >
分享
所有回答(1)
0

........

archie2010 | 园豆:205 (菜鸟二级) | 2011-11-04 14:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册