sgwood wrote:
Seeing all the " Creating new JDBC connection" messages makes me think your session management is wrong. You should be getting a session from the factory for each thread, not each time you access Hibernate and the database. Try ThreadLocal if this is the problem.
Sherman
That makes a lot of sense, but I sort of thought Spring would be doing that for me :/ I'll google to see how I can change that with spring.
Also, I did some sql debug outputs. Here is the second pass, after the items are cached. I'm guessing that generating sql output in Idea probably slows the queries down by 300% - probably has something to do with the speed that it writes/directs output that gui window within IDEA. Anyway, here they are... they are freaking massive :((((
---
23:30:37,046 DEBUG SQL:237 - select page0_.id as id, page0_.pageAbstractionId as pageAbst2_, page0_.parentPageId as parentPa3_, page0_.languageId as languageId, page0_.ownerId as ownerId, page0_.viewId as viewId, page0_.name as name, page0_.headerName as headerName, page0_.title as title, page0_.content as content, page0_.keywords as keywords, page0_.isPublished as isPubli12_, page0_.publishedOn as publish13_, page0_.hideOnSitemap as hideOnS14_, page0_.allowComments as allowCo15_, page0_.createdOn as createdOn, page0_.isActive as isActive from page page0_ where (name=? )and(languageId=? )
---
findAllPagesByName took: 469
---
23:30:37,187 DEBUG SQL:237 - select menuitem0_.id as id, menuitem0_.parentId as parentId, menuitem0_.languageId as languageId, menuitem0_.name as name, menuitem0_.pageId as pageId, menuitem0_.orderIndex as orderIndex, menuitem0_.graphicHeight as graphicH7_, menuitem0_.graphicWidth as graphicW8_, menuitem0_.onGraphic as onGraphic, menuitem0_.offGraphic as offGraphic, menuitem0_.headerGraphic as headerG11_, menuitem0_.createdOn as createdOn, menuitem0_.isActive as isActive from menu_item menuitem0_ where (parentId is null )and(languageId=? )
23:30:37,203 DEBUG SQL:237 - select language0_.id as id0_, language0_.name as name0_, language0_.code as code0_, language0_.createdOn as createdOn0_, language0_.isActive as isActive0_ from language language0_ where language0_.id=?
23:30:37,203 DEBUG SQL:237 - select pageabstra0_.id as id0_, pageabstra0_.name as name0_, pageabstra0_.createdOn as createdOn0_, pageabstra0_.isActive as isActive0_ from page_abstraction pageabstra0_ where pageabstra0_.id=?
23:30:37,203 DEBUG SQL:237 - select user0_.id as id2_, user0_.firstName as firstName2_, user0_.lastName as lastName2_, user0_.username as username2_, user0_.password as password2_, user0_.sessionId as sessionId2_, user0_.userRoleId as userRoleId2_, user0_.createdOn as createdOn2_, user0_.isActive as isActive2_, session1_.id as id0_, session1_.sessionId as sessionId0_, session1_.createdOn as createdOn0_, session1_.isActive as isActive0_, userrole2_.id as id1_, userrole2_.name as name1_, userrole2_.level as level1_, userrole2_.createdOn as createdOn1_, userrole2_.isActive as isActive1_ from user_account user0_ left outer join session session1_ on user0_.sessionId=session1_.id left outer join user_role userrole2_ on user0_.userRoleId=userrole2_.id where user0_.id=?
23:30:37,218 DEBUG SQL:237 - select view0_.id as id1_, view0_.name as name1_, view0_.description as descript3_1_, view0_.decoratorPage as decorato4_1_, view0_.viewTypeId as viewTypeId1_, view0_.createdOn as createdOn1_, view0_.isActive as isActive1_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_ from view view0_ left outer join view_type viewtype1_ on view0_.viewTypeId=viewtype1_.id where view0_.id=?
23:30:37,234 DEBUG SQL:237 - select components0_.id as id__, components0_.viewId as viewId__, components0_.id as id3_, components0_.name as name3_, components0_.viewTypeId as viewTypeId3_, components0_.defaultIsVisible as defaultI4_3_, components0_.defaultViewId as defaultV5_3_, components0_.createdOn as createdOn3_, components0_.isActive as isActive3_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_, view2_.id as id1_, view2_.name as name1_, view2_.description as descript3_1_, view2_.decoratorPage as decorato4_1_, view2_.viewTypeId as viewTypeId1_, view2_.createdOn as createdOn1_, view2_.isActive as isActive1_, viewtype3_.id as id2_, viewtype3_.name as name2_, viewtype3_.description as descript3_2_, viewtype3_.createdOn as createdOn2_, viewtype3_.isActive as isActive2_ from view_component components0_ left outer join view_type viewtype1_ on components0_.viewTypeId=viewtype1_.id left outer join view view2_ on components0_.defaultViewId=view2_.id left outer join view_type viewtype3_ on view2_.viewTypeId=viewtype3_.id where components0_.viewId=? order by components0_.name
23:30:37,328 DEBUG SQL:237 - select components0_.id as id__, components0_.viewId as viewId__, components0_.id as id3_, components0_.name as name3_, components0_.viewTypeId as viewTypeId3_, components0_.defaultIsVisible as defaultI4_3_, components0_.defaultViewId as defaultV5_3_, components0_.createdOn as createdOn3_, components0_.isActive as isActive3_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_, view2_.id as id1_, view2_.name as name1_, view2_.description as descript3_1_, view2_.decoratorPage as decorato4_1_, view2_.viewTypeId as viewTypeId1_, view2_.createdOn as createdOn1_, view2_.isActive as isActive1_, viewtype3_.id as id2_, viewtype3_.name as name2_, viewtype3_.description as descript3_2_, viewtype3_.createdOn as createdOn2_, viewtype3_.isActive as isActive2_ from view_component components0_ left outer join view_type viewtype1_ on components0_.viewTypeId=viewtype1_.id left outer join view view2_ on components0_.defaultViewId=view2_.id left outer join view_type viewtype3_ on view2_.viewTypeId=viewtype3_.id where components0_.viewId=? order by components0_.name
23:30:37,343 DEBUG SQL:237 - select attributes0_.id as id__, attributes0_.viewId as viewId__, attributes0_.id as id0_, attributes0_.name as name0_, attributes0_.type as type0_, attributes0_.defaultValue as defaultV4_0_, attributes0_.createdOn as createdOn0_, attributes0_.isActive as isActive0_ from view_attribute attributes0_ where attributes0_.viewId=? order by attributes0_.name
23:30:37,453 DEBUG SQL:237 - select attributes0_.id as id__, attributes0_.viewId as viewId__, attributes0_.id as id0_, attributes0_.name as name0_, attributes0_.type as type0_, attributes0_.defaultValue as defaultV4_0_, attributes0_.createdOn as createdOn0_, attributes0_.isActive as isActive0_ from view_attribute attributes0_ where attributes0_.viewId=? order by attributes0_.name
23:30:37,453 DEBUG SQL:237 - select privileges0_.userPrivilegeId as userPriv2___, privileges0_.userId as userId__, userprivil1_.id as id0_, userprivil1_.name as name0_, userprivil1_.description as descript3_0_, userprivil1_.createdOn as createdOn0_, userprivil1_.isActive as isActive0_ from user_privilege_relation privileges0_ inner join user_privilege userprivil1_ on privileges0_.userPrivilegeId=userprivil1_.id where privileges0_.userId=?
23:30:37,468 DEBUG SQL:237 - select groups0_.userGroupId as userGrou2___, groups0_.userId as userId__, usergroup1_.id as id0_, usergroup1_.name as name0_, usergroup1_.level as level0_, usergroup1_.createdOn as createdOn0_, usergroup1_.isActive as isActive0_ from user_group_relation groups0_ inner join user_group usergroup1_ on groups0_.userGroupId=usergroup1_.id where groups0_.userId=?
---
findRootMenuItemWithLanguage took: 406
---
23:30:37,781 DEBUG SQL:237 - select menuitem0_.id as id, menuitem0_.parentId as parentId, menuitem0_.languageId as languageId, menuitem0_.name as name, menuitem0_.pageId as pageId, menuitem0_.orderIndex as orderIndex, menuitem0_.graphicHeight as graphicH7_, menuitem0_.graphicWidth as graphicW8_, menuitem0_.onGraphic as onGraphic, menuitem0_.offGraphic as offGraphic, menuitem0_.headerGraphic as headerG11_, menuitem0_.createdOn as createdOn, menuitem0_.isActive as isActive from menu_item menuitem0_ where (parentId is null )
23:30:37,796 DEBUG SQL:237 - select language0_.id as id0_, language0_.name as name0_, language0_.code as code0_, language0_.createdOn as createdOn0_, language0_.isActive as isActive0_ from language language0_ where language0_.id=?
23:30:37,796 DEBUG SQL:237 - select pageabstra0_.id as id0_, pageabstra0_.name as name0_, pageabstra0_.createdOn as createdOn0_, pageabstra0_.isActive as isActive0_ from page_abstraction pageabstra0_ where pageabstra0_.id=?
23:30:37,796 DEBUG SQL:237 - select user0_.id as id2_, user0_.firstName as firstName2_, user0_.lastName as lastName2_, user0_.username as username2_, user0_.password as password2_, user0_.sessionId as sessionId2_, user0_.userRoleId as userRoleId2_, user0_.createdOn as createdOn2_, user0_.isActive as isActive2_, session1_.id as id0_, session1_.sessionId as sessionId0_, session1_.createdOn as createdOn0_, session1_.isActive as isActive0_, userrole2_.id as id1_, userrole2_.name as name1_, userrole2_.level as level1_, userrole2_.createdOn as createdOn1_, userrole2_.isActive as isActive1_ from user_account user0_ left outer join session session1_ on user0_.sessionId=session1_.id left outer join user_role userrole2_ on user0_.userRoleId=userrole2_.id where user0_.id=?
23:30:37,812 DEBUG SQL:237 - select view0_.id as id1_, view0_.name as name1_, view0_.description as descript3_1_, view0_.decoratorPage as decorato4_1_, view0_.viewTypeId as viewTypeId1_, view0_.createdOn as createdOn1_, view0_.isActive as isActive1_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_ from view view0_ left outer join view_type viewtype1_ on view0_.viewTypeId=viewtype1_.id where view0_.id=?
23:30:37,828 DEBUG SQL:237 - select components0_.id as id__, components0_.viewId as viewId__, components0_.id as id3_, components0_.name as name3_, components0_.viewTypeId as viewTypeId3_, components0_.defaultIsVisible as defaultI4_3_, components0_.defaultViewId as defaultV5_3_, components0_.createdOn as createdOn3_, components0_.isActive as isActive3_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_, view2_.id as id1_, view2_.name as name1_, view2_.description as descript3_1_, view2_.decoratorPage as decorato4_1_, view2_.viewTypeId as viewTypeId1_, view2_.createdOn as createdOn1_, view2_.isActive as isActive1_, viewtype3_.id as id2_, viewtype3_.name as name2_, viewtype3_.description as descript3_2_, viewtype3_.createdOn as createdOn2_, viewtype3_.isActive as isActive2_ from view_component components0_ left outer join view_type viewtype1_ on components0_.viewTypeId=viewtype1_.id left outer join view view2_ on components0_.defaultViewId=view2_.id left outer join view_type viewtype3_ on view2_.viewTypeId=viewtype3_.id where components0_.viewId=? order by components0_.name
23:30:37,968 DEBUG SQL:237 - select components0_.id as id__, components0_.viewId as viewId__, components0_.id as id3_, components0_.name as name3_, components0_.viewTypeId as viewTypeId3_, components0_.defaultIsVisible as defaultI4_3_, components0_.defaultViewId as defaultV5_3_, components0_.createdOn as createdOn3_, components0_.isActive as isActive3_, viewtype1_.id as id0_, viewtype1_.name as name0_, viewtype1_.description as descript3_0_, viewtype1_.createdOn as createdOn0_, viewtype1_.isActive as isActive0_, view2_.id as id1_, view2_.name as name1_, view2_.description as descript3_1_, view2_.decoratorPage as decorato4_1_, view2_.viewTypeId as viewTypeId1_, view2_.createdOn as createdOn1_, view2_.isActive as isActive1_, viewtype3_.id as id2_, viewtype3_.name as name2_, viewtype3_.description as descript3_2_, viewtype3_.createdOn as createdOn2_, viewtype3_.isActive as isActive2_ from view_component components0_ left outer join view_type viewtype1_ on components0_.viewTypeId=viewtype1_.id left outer join view view2_ on components0_.defaultViewId=view2_.id left outer join view_type viewtype3_ on view2_.viewTypeId=viewtype3_.id where components0_.viewId=? order by components0_.name
23:30:37,968 DEBUG SQL:237 - select attributes0_.id as id__, attributes0_.viewId as viewId__, attributes0_.id as id0_, attributes0_.name as name0_, attributes0_.type as type0_, attributes0_.defaultValue as defaultV4_0_, attributes0_.createdOn as createdOn0_, attributes0_.isActive as isActive0_ from view_attribute attributes0_ where attributes0_.viewId=? order by attributes0_.name
23:30:37,984 DEBUG SQL:237 - select attributes0_.id as id__, attributes0_.viewId as viewId__, attributes0_.id as id0_, attributes0_.name as name0_, attributes0_.type as type0_, attributes0_.defaultValue as defaultV4_0_, attributes0_.createdOn as createdOn0_, attributes0_.isActive as isActive0_ from view_attribute attributes0_ where attributes0_.viewId=? order by attributes0_.name
23:30:38,000 DEBUG SQL:237 - select privileges0_.userPrivilegeId as userPriv2___, privileges0_.userId as userId__, userprivil1_.id as id0_, userprivil1_.name as name0_, userprivil1_.description as descript3_0_, userprivil1_.createdOn as createdOn0_, userprivil1_.isActive as isActive0_ from user_privilege_relation privileges0_ inner join user_privilege userprivil1_ on privileges0_.userPrivilegeId=userprivil1_.id where privileges0_.userId=?
23:30:38,000 DEBUG SQL:237 - select groups0_.userGroupId as userGrou2___, groups0_.userId as userId__, usergroup1_.id as id0_, usergroup1_.name as name0_, usergroup1_.level as level0_, usergroup1_.createdOn as createdOn0_, usergroup1_.isActive as isActive0_ from user_group_relation groups0_ inner join user_group usergroup1_ on groups0_.userGroupId=usergroup1_.id where groups0_.userId=?
findAllRootMenuItems took: 547
---