hi , guys
i used a hql to execute in hibernate
Code:
from Post as post inner join post.postContent inner join post.poster where post.thread.threadID = :threadid order by post.postTime
it took 170 milliseconds
it's too slow to my opinion , so i want to find out for why
i got the sql from this hql , it is:
[code]
select post0_.postID as postID0_, postcont1_.postContentID as postContentID1_, simplefo2_.forumUserID as forumUserID2_, simpleus3_.userID as userID3_, post0_.postTime as postTime0_, post0_.enableFNCode as enableFN3_0_, post0_.enableHtml as enableHtml0_, post0_.enableSignature as enableSi5_0_, post0_.enableSmile as enableSm6_0_, post0_.visuable as visuable0_, post0_.iconID as iconID0_, post0_.threadID as threadID0_, post0_.posterID as posterID0_, post0_.attachFile as attachFile0_, post0_.emailNotice as emailNo12_0_, post0_.enableImg as enableImg0_, postcont1_.subject as subject1_, postcont1_.ip as ip1_, postcont1_.notes as notes1_, postcont1_.content as content1_, simplefo2_.userID as userID2_, simplefo2_.signature as signature2_, simplefo2_.postCount as postCount2_, simplefo2_.title as title2_, simplefo2_.faceID as faceID2_, simpleus3_.userName as userName3_, simpleus3_.registerDate as register3_3_, simpleus3_.location as location3_, simpleus3_.passWord as passWord3_ from Post post0_ inner join PostContent postcont1_ on post0_.postID=postcont1_.postContentID inner join ForumUser simplefo2_ on post0_.posterID=simplefo2_.forumUserID inner join UserInfo simpleus3_ on simplefo2_.userID=simpleus3_.userID where (post0_.threadID=? ) order by post0_.postTime asc limit 0 , 15
[code]
and then i use jdbc directly , like this:
[code]
ps = conn.prepareStatement(LOAD_PROPERTIES);
ps.setInt(1 , 10000);
java.sql.ResultSet rs = ps.executeQuery();
[code]
it only took 70 milliseconds
i don't belive hibernate is so slow
so i change the code to:
[code]
java.sql.Connection conn =
session.connection()[color];
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1 , threadID);
ps.execute();
[/code]
[color=red]still 170 milliseconds
i can't understand what's different between thme at all
who can tell me why???
thanks for your attention.