首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

不知Hibernate在哪儿耗时间

2012-11-04 
不知Hibernate在哪里耗时间(1)long time System.currentTimeMillis()ResultSet rs stmt.executeQuery

不知Hibernate在哪里耗时间
(1)
long time = System.currentTimeMillis();
ResultSet rs = stmt.executeQuery("select * from Tbl_Mms_User where MobilePhone='13956478952'");
System.out.println("xxxxxx:" + (System.currentTimeMillis() - time));

(2)
long time = System.currentTimeMillis();
List list = dao.find("select user from TblMmsUser user where user.MobilePhone=?", mobilePhone, Hibernate.STRING);
System.out.println("BaseReceiver.xxxxxx:" + (System.currentTimeMillis() - time));




这两段代码前一个直接用JDBC用时0,后一个Hibernate用时36

发问的原因中实际系统中用的是后一个,性能有很大问题,一个简单的查询尽用了0.5秒,表在MobilePhone有索引
数据库是SQLServer2000 1 楼 DBoy 2007-01-17   大家有时间投票我的贴为新手贴,咋就没个老手来解释下呢 2 楼 抛出异常的爱 2007-01-17   由于你查的字段没有建索引。。。。

热点排行