-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: Why Hibernate select all table's data when I run
PostPosted: Mon Dec 07, 2015 11:16 am 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
On netbeans colsole, i see that hibernate select all datas (of all tables)

example: get all article collection size

Code:
ArticleDAO artdao=new ArticleDAOImpl();
        int lsize=artdao.findAll().size();
        System.out.println(lsize);


colsole run Netbeans


déc. 07, 2015 4:12:41 PM org.hibernate.search.backend.impl.lucene.SyncWorkProcessor start
INFO: HSEARCH000230: Starting sync consumer thread for index 'com.nsium.nscloud.dal.model.Folder'
déc. 07, 2015 4:12:52 PM org.hibernate.search.backend.impl.lucene.SyncWorkProcessor start
INFO: HSEARCH000230: Starting sync consumer thread for index 'com.nsium.nscloud.dal.model.Document'
Hibernate: select article0_.id as id1_2_, article0_.creator_id as creator_2_2_, article0_.article as article3_2_, article0_.commentcount as commentc4_2_, article0_.creation_time as creation5_2_, article0_.dislikecount as dislikec6_2_, article0_.editingpassword as editingp7_2_, article0_.likecount as likecoun8_2_, article0_.picture_filename as picture_9_2_, article0_.rootcommentcount as rootcom10_2_, article0_.title as title11_2_, article0_.totallikecount as totalli12_2_, article0_.websitelink as website13_2_ from public.article article0_
Hibernate: select user0_.id_user as id_user1_22_0_, user0_.id_user_profile as id_user_2_22_0_, user0_.name as name3_22_0_, user0_.firstname as firstnam4_22_0_, user0_.email as email5_22_0_, user0_.login as login6_22_0_, user0_.password as password7_22_0_, user0_.created as created8_22_0_, user0_.modified as modified9_22_0_, user0_.created_by as created10_22_0_, user0_.modified_by as modifie11_22_0_, user0_.avatar_filename as avatar_12_22_0_, user0_.state as state13_22_0_ from public.user user0_ where user0_.id_user=?
Hibernate: select userprofil0_.id_user_profile as id_user_1_23_0_, userprofil0_.name as name2_23_0_, userprofil0_.description as descript3_23_0_, userprofil0_.created as created4_23_0_, userprofil0_.modified as modified5_23_0_, userprofil0_.created_by as created_6_23_0_, userprofil0_.modified_by as modified7_23_0_ from public.user_profile userprofil0_ where userprofil0_.id_user_profile=?
Hibernate: select articlerep0_.article_id as article_3_2_0_, articlerep0_.id as id1_3_0_, articlerep0_.id as id1_3_1_, articlerep0_.user_id as user_id2_3_1_, articlerep0_.article_id as article_3_3_1_, articlerep0_.reporttype as reportty4_3_1_ from public.articlereport articlerep0_ where articlerep0_.article_id=?
Hibernate: select comments0_.article_id as article_4_2_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.article_id=?
Hibernate: select comments0_.answered_id as answered3_4_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.answered_id=?
Hibernate: select commentrep0_.comment_id as comment_3_4_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.comment_id=?
Hibernate: select comments0_.answered_id as answered3_4_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.answered_id=?
Hibernate: select commentrep0_.comment_id as comment_3_4_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.comment_id=?
Hibernate: select comments0_.answered_id as answered3_4_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.answered_id=?
Hibernate: select commentrep0_.comment_id as comment_3_4_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.comment_id=?
Hibernate: select comments0_.user_id as user_id2_22_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.user_id=?
Hibernate: select commentrep0_.user_id as user_id2_22_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.user_id=?
Hibernate: select communitie0_.id_user as id_user1_22_0_, communitie0_.id_community as id_commu2_0_0_, community1_.id_community as id_commu1_6_1_, community1_.id_community_profile as id_commu2_6_1_, community1_.name as name3_6_1_, community1_.description as descript4_6_1_, community1_.created as created5_6_1_, community1_.modified as modified6_6_1_, community1_.created_by as created_7_6_1_, community1_.modified_by as modified8_6_1_, community1_.state as state9_6_1_ from communities_users communitie0_ inner join public.community community1_ on communitie0_.id_community=community1_.id_community where communitie0_.id_user=?
Hibernate: select articlerep0_.user_id as user_id2_22_0_, articlerep0_.id as id1_3_0_, articlerep0_.id as id1_3_1_, articlerep0_.user_id as user_id2_3_1_, articlerep0_.article_id as article_3_3_1_, articlerep0_.reporttype as reportty4_3_1_ from public.articlereport articlerep0_ where articlerep0_.user_id=?
Hibernate: select articles0_.creator_id as creator_2_22_0_, articles0_.id as id1_2_0_, articles0_.id as id1_2_1_, articles0_.creator_id as creator_2_2_1_, articles0_.article as article3_2_1_, articles0_.commentcount as commentc4_2_1_, articles0_.creation_time as creation5_2_1_, articles0_.dislikecount as dislikec6_2_1_, articles0_.editingpassword as editingp7_2_1_, articles0_.likecount as likecoun8_2_1_, articles0_.picture_filename as picture_9_2_1_, articles0_.rootcommentcount as rootcom10_2_1_, articles0_.title as title11_2_1_, articles0_.totallikecount as totalli12_2_1_, articles0_.websitelink as website13_2_1_ from public.article articles0_ where articles0_.creator_id=?
Hibernate: select folderrigh0_.id_user as id_user2_22_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_user=?
Hibernate: select folder0_.id_folder as id_folde1_11_0_, folder0_.id_parent_folder as id_paren2_11_0_, folder0_.name as name3_11_0_, folder0_.created as created4_11_0_, folder0_.modified as modified5_11_0_, folder0_.created_by as created_6_11_0_, folder0_.modified_by as modified7_11_0_ from public.folder folder0_ where folder0_.id_folder=?
Hibernate: select folder0_.id_folder as id_folde1_11_0_, folder0_.id_parent_folder as id_paren2_11_0_, folder0_.name as name3_11_0_, folder0_.created as created4_11_0_, folder0_.modified as modified5_11_0_, folder0_.created_by as created_6_11_0_, folder0_.modified_by as modified7_11_0_ from public.folder folder0_ where folder0_.id_folder=?
Hibernate: select folder0_.id_folder as id_folde1_11_0_, folder0_.id_parent_folder as id_paren2_11_0_, folder0_.name as name3_11_0_, folder0_.created as created4_11_0_, folder0_.modified as modified5_11_0_, folder0_.created_by as created_6_11_0_, folder0_.modified_by as modified7_11_0_ from public.folder folder0_ where folder0_.id_folder=?
Hibernate: select documents0_.id_folder as id_folde2_11_0_, documents0_.id_document as id_docum1_1_0_, document1_.id_document as id_docum1_8_1_, document1_.name as name2_8_1_, document1_.webform as webform3_8_1_, document1_.content as content4_8_1_, document1_.tag_clouds as tag_clou5_8_1_, document1_.summary as summary6_8_1_, document1_.created as created7_8_1_, document1_.modified as modified8_8_1_, document1_.created_by as created_9_8_1_, document1_.modified_by as modifie10_8_1_ from folders_documents documents0_ inner join public.document document1_ on documents0_.id_document=document1_.id_document where documents0_.id_folder=?
Hibernate: select folderrigh0_.id_folder as id_folde3_11_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_folder=?
Hibernate: select user0_.id_user as id_user1_22_0_, user0_.id_user_profile as id_user_2_22_0_, user0_.name as name3_22_0_, user0_.firstname as firstnam4_22_0_, user0_.email as email5_22_0_, user0_.login as login6_22_0_, user0_.password as password7_22_0_, user0_.created as created8_22_0_, user0_.modified as modified9_22_0_, user0_.created_by as created10_22_0_, user0_.modified_by as modifie11_22_0_, user0_.avatar_filename as avatar_12_22_0_, user0_.state as state13_22_0_ from public.user user0_ where user0_.id_user=?
Hibernate: select comments0_.user_id as user_id2_22_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.user_id=?
Hibernate: select commentrep0_.user_id as user_id2_22_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.user_id=?
Hibernate: select communitie0_.id_user as id_user1_22_0_, communitie0_.id_community as id_commu2_0_0_, community1_.id_community as id_commu1_6_1_, community1_.id_community_profile as id_commu2_6_1_, community1_.name as name3_6_1_, community1_.description as descript4_6_1_, community1_.created as created5_6_1_, community1_.modified as modified6_6_1_, community1_.created_by as created_7_6_1_, community1_.modified_by as modified8_6_1_, community1_.state as state9_6_1_ from communities_users communitie0_ inner join public.community community1_ on communitie0_.id_community=community1_.id_community where communitie0_.id_user=?
Hibernate: select communityp0_.id_community_profile as id_commu1_7_0_, communityp0_.name as name2_7_0_, communityp0_.description as descript3_7_0_, communityp0_.created as created4_7_0_, communityp0_.modified as modified5_7_0_, communityp0_.created_by as created_6_7_0_, communityp0_.modified_by as modified7_7_0_ from public.community_profile communityp0_ where communityp0_.id_community_profile=?
Hibernate: select communityp0_.id_community_profile as id_commu1_7_0_, communityp0_.name as name2_7_0_, communityp0_.description as descript3_7_0_, communityp0_.created as created4_7_0_, communityp0_.modified as modified5_7_0_, communityp0_.created_by as created_6_7_0_, communityp0_.modified_by as modified7_7_0_ from public.community_profile communityp0_ where communityp0_.id_community_profile=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select functionnn0_.id_community_profile as id_commu3_7_0_, functionnn0_.id_functionnnal_rights as id_funct1_13_0_, functionnn0_.id_functionnnal_rights as id_funct1_13_1_, functionnn0_.id_type_of_right as id_type_2_13_1_, functionnn0_.id_community_profile as id_commu3_13_1_, functionnn0_.id_submenu as id_subme4_13_1_, functionnn0_.id_user_profile as id_user_5_13_1_, functionnn0_.created as created6_13_1_, functionnn0_.modified as modified7_13_1_, functionnn0_.created_by as created_8_13_1_, functionnn0_.modified_by as modified9_13_1_ from public.functionnnal_rights functionnn0_ where functionnn0_.id_community_profile=?
Hibernate: select communitie0_.id_community_profile as id_commu2_7_0_, communitie0_.id_community as id_commu1_6_0_, communitie0_.id_community as id_commu1_6_1_, communitie0_.id_community_profile as id_commu2_6_1_, communitie0_.name as name3_6_1_, communitie0_.description as descript4_6_1_, communitie0_.created as created5_6_1_, communitie0_.modified as modified6_6_1_, communitie0_.created_by as created_7_6_1_, communitie0_.modified_by as modified8_6_1_, communitie0_.state as state9_6_1_ from public.community communitie0_ where communitie0_.id_community_profile=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select comments0_.user_id as user_id2_22_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.user_id=?
Hibernate: select commentrep0_.user_id as user_id2_22_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.user_id=?
Hibernate: select communitie0_.id_user as id_user1_22_0_, communitie0_.id_community as id_commu2_0_0_, community1_.id_community as id_commu1_6_1_, community1_.id_community_profile as id_commu2_6_1_, community1_.name as name3_6_1_, community1_.description as descript4_6_1_, community1_.created as created5_6_1_, community1_.modified as modified6_6_1_, community1_.created_by as created_7_6_1_, community1_.modified_by as modified8_6_1_, community1_.state as state9_6_1_ from communities_users communitie0_ inner join public.community community1_ on communitie0_.id_community=community1_.id_community where communitie0_.id_user=?
Hibernate: select articlerep0_.user_id as user_id2_22_0_, articlerep0_.id as id1_3_0_, articlerep0_.id as id1_3_1_, articlerep0_.user_id as user_id2_3_1_, articlerep0_.article_id as article_3_3_1_, articlerep0_.reporttype as reportty4_3_1_ from public.articlereport articlerep0_ where articlerep0_.user_id=?
Hibernate: select articles0_.creator_id as creator_2_22_0_, articles0_.id as id1_2_0_, articles0_.id as id1_2_1_, articles0_.creator_id as creator_2_2_1_, articles0_.article as article3_2_1_, articles0_.commentcount as commentc4_2_1_, articles0_.creation_time as creation5_2_1_, articles0_.dislikecount as dislikec6_2_1_, articles0_.editingpassword as editingp7_2_1_, articles0_.likecount as likecoun8_2_1_, articles0_.picture_filename as picture_9_2_1_, articles0_.rootcommentcount as rootcom10_2_1_, articles0_.title as title11_2_1_, articles0_.totallikecount as totalli12_2_1_, articles0_.websitelink as website13_2_1_ from public.article articles0_ where articles0_.creator_id=?
Hibernate: select folderrigh0_.id_user as id_user2_22_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_user=?
Hibernate: select folder0_.id_folder as id_folde1_11_0_, folder0_.id_parent_folder as id_paren2_11_0_, folder0_.name as name3_11_0_, folder0_.created as created4_11_0_, folder0_.modified as modified5_11_0_, folder0_.created_by as created_6_11_0_, folder0_.modified_by as modified7_11_0_ from public.folder folder0_ where folder0_.id_folder=?
Hibernate: select documents0_.id_folder as id_folde2_11_0_, documents0_.id_document as id_docum1_1_0_, document1_.id_document as id_docum1_8_1_, document1_.name as name2_8_1_, document1_.webform as webform3_8_1_, document1_.content as content4_8_1_, document1_.tag_clouds as tag_clou5_8_1_, document1_.summary as summary6_8_1_, document1_.created as created7_8_1_, document1_.modified as modified8_8_1_, document1_.created_by as created_9_8_1_, document1_.modified_by as modifie10_8_1_ from folders_documents documents0_ inner join public.document document1_ on documents0_.id_document=document1_.id_document where documents0_.id_folder=?
Hibernate: select folders0_.id_document as id_docum1_8_0_, folders0_.id_folder as id_folde2_1_0_, folder1_.id_folder as id_folde1_11_1_, folder1_.id_parent_folder as id_paren2_11_1_, folder1_.name as name3_11_1_, folder1_.created as created4_11_1_, folder1_.modified as modified5_11_1_, folder1_.created_by as created_6_11_1_, folder1_.modified_by as modified7_11_1_ from folders_documents folders0_ inner join public.folder folder1_ on folders0_.id_folder=folder1_.id_folder where folders0_.id_document=?
Hibernate: select documentri0_.id_document as id_docum3_8_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_document=?
Hibernate: select results0_.id_document as id_docum3_8_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_document=?
Hibernate: select folderrigh0_.id_folder as id_folde3_11_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_folder=?
Hibernate: select childfolde0_.id_parent_folder as id_paren2_11_0_, childfolde0_.id_folder as id_folde1_11_0_, childfolde0_.id_folder as id_folde1_11_1_, childfolde0_.id_parent_folder as id_paren2_11_1_, childfolde0_.name as name3_11_1_, childfolde0_.created as created4_11_1_, childfolde0_.modified as modified5_11_1_, childfolde0_.created_by as created_6_11_1_, childfolde0_.modified_by as modified7_11_1_ from public.folder childfolde0_ where childfolde0_.id_parent_folder=?
Hibernate: select documentri0_.id_user as id_user2_22_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_user=?
Hibernate: select queries0_.id_user as id_user2_22_0_, queries0_.id_query as id_query1_16_0_, queries0_.id_query as id_query1_16_1_, queries0_.id_user as id_user2_16_1_, queries0_.query_string as query_st3_16_1_, queries0_.name as name4_16_1_, queries0_.description as descript5_16_1_, queries0_.is_public as is_publi6_16_1_, queries0_.is_automatic as is_autom7_16_1_ from public.nsquery queries0_ where queries0_.id_user=?
Hibernate: select results0_.id_user as id_user2_22_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_user=?
Hibernate: select functionnn0_.id_community_profile as id_commu3_7_0_, functionnn0_.id_functionnnal_rights as id_funct1_13_0_, functionnn0_.id_functionnnal_rights as id_funct1_13_1_, functionnn0_.id_type_of_right as id_type_2_13_1_, functionnn0_.id_community_profile as id_commu3_13_1_, functionnn0_.id_submenu as id_subme4_13_1_, functionnn0_.id_user_profile as id_user_5_13_1_, functionnn0_.created as created6_13_1_, functionnn0_.modified as modified7_13_1_, functionnn0_.created_by as created_8_13_1_, functionnn0_.modified_by as modified9_13_1_ from public.functionnnal_rights functionnn0_ where functionnn0_.id_community_profile=?
Hibernate: select communitie0_.id_community_profile as id_commu2_7_0_, communitie0_.id_community as id_commu1_6_0_, communitie0_.id_community as id_commu1_6_1_, communitie0_.id_community_profile as id_commu2_6_1_, communitie0_.name as name3_6_1_, communitie0_.description as descript4_6_1_, communitie0_.created as created5_6_1_, communitie0_.modified as modified6_6_1_, communitie0_.created_by as created_7_6_1_, communitie0_.modified_by as modified8_6_1_, communitie0_.state as state9_6_1_ from public.community communitie0_ where communitie0_.id_community_profile=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select users0_.id_community as id_commu2_6_0_, users0_.id_user as id_user1_0_0_, user1_.id_user as id_user1_22_1_, user1_.id_user_profile as id_user_2_22_1_, user1_.name as name3_22_1_, user1_.firstname as firstnam4_22_1_, user1_.email as email5_22_1_, user1_.login as login6_22_1_, user1_.password as password7_22_1_, user1_.created as created8_22_1_, user1_.modified as modified9_22_1_, user1_.created_by as created10_22_1_, user1_.modified_by as modifie11_22_1_, user1_.avatar_filename as avatar_12_22_1_, user1_.state as state13_22_1_ from communities_users users0_ inner join public.user user1_ on users0_.id_user=user1_.id_user where users0_.id_community=?
Hibernate: select articlerep0_.user_id as user_id2_22_0_, articlerep0_.id as id1_3_0_, articlerep0_.id as id1_3_1_, articlerep0_.user_id as user_id2_3_1_, articlerep0_.article_id as article_3_3_1_, articlerep0_.reporttype as reportty4_3_1_ from public.articlereport articlerep0_ where articlerep0_.user_id=?
Hibernate: select articles0_.creator_id as creator_2_22_0_, articles0_.id as id1_2_0_, articles0_.id as id1_2_1_, articles0_.creator_id as creator_2_2_1_, articles0_.article as article3_2_1_, articles0_.commentcount as commentc4_2_1_, articles0_.creation_time as creation5_2_1_, articles0_.dislikecount as dislikec6_2_1_, articles0_.editingpassword as editingp7_2_1_, articles0_.likecount as likecoun8_2_1_, articles0_.picture_filename as picture_9_2_1_, articles0_.rootcommentcount as rootcom10_2_1_, articles0_.title as title11_2_1_, articles0_.totallikecount as totalli12_2_1_, articles0_.websitelink as website13_2_1_ from public.article articles0_ where articles0_.creator_id=?
Hibernate: select folderrigh0_.id_user as id_user2_22_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_user=?
Hibernate: select documentri0_.id_user as id_user2_22_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_user=?
Hibernate: select document0_.id_document as id_docum1_8_0_, document0_.name as name2_8_0_, document0_.webform as webform3_8_0_, document0_.content as content4_8_0_, document0_.tag_clouds as tag_clou5_8_0_, document0_.summary as summary6_8_0_, document0_.created as created7_8_0_, document0_.modified as modified8_8_0_, document0_.created_by as created_9_8_0_, document0_.modified_by as modifie10_8_0_ from public.document document0_ where document0_.id_document=?
Hibernate: select document0_.id_document as id_docum1_8_0_, document0_.name as name2_8_0_, document0_.webform as webform3_8_0_, document0_.content as content4_8_0_, document0_.tag_clouds as tag_clou5_8_0_, document0_.summary as summary6_8_0_, document0_.created as created7_8_0_, document0_.modified as modified8_8_0_, document0_.created_by as created_9_8_0_, document0_.modified_by as modifie10_8_0_ from public.document document0_ where document0_.id_document=?
Hibernate: select document0_.id_document as id_docum1_8_0_, document0_.name as name2_8_0_, document0_.webform as webform3_8_0_, document0_.content as content4_8_0_, document0_.tag_clouds as tag_clou5_8_0_, document0_.summary as summary6_8_0_, document0_.created as created7_8_0_, document0_.modified as modified8_8_0_, document0_.created_by as created_9_8_0_, document0_.modified_by as modifie10_8_0_ from public.document document0_ where document0_.id_document=?
Hibernate: select folders0_.id_document as id_docum1_8_0_, folders0_.id_folder as id_folde2_1_0_, folder1_.id_folder as id_folde1_11_1_, folder1_.id_parent_folder as id_paren2_11_1_, folder1_.name as name3_11_1_, folder1_.created as created4_11_1_, folder1_.modified as modified5_11_1_, folder1_.created_by as created_6_11_1_, folder1_.modified_by as modified7_11_1_ from folders_documents folders0_ inner join public.folder folder1_ on folders0_.id_folder=folder1_.id_folder where folders0_.id_document=?
Hibernate: select documentri0_.id_document as id_docum3_8_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_document=?
Hibernate: select results0_.id_document as id_docum3_8_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_document=?
Hibernate: select folders0_.id_document as id_docum1_8_0_, folders0_.id_folder as id_folde2_1_0_, folder1_.id_folder as id_folde1_11_1_, folder1_.id_parent_folder as id_paren2_11_1_, folder1_.name as name3_11_1_, folder1_.created as created4_11_1_, folder1_.modified as modified5_11_1_, folder1_.created_by as created_6_11_1_, folder1_.modified_by as modified7_11_1_ from folders_documents folders0_ inner join public.folder folder1_ on folders0_.id_folder=folder1_.id_folder where folders0_.id_document=?
Hibernate: select documentri0_.id_document as id_docum3_8_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_document=?
Hibernate: select results0_.id_document as id_docum3_8_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_document=?
Hibernate: select folders0_.id_document as id_docum1_8_0_, folders0_.id_folder as id_folde2_1_0_, folder1_.id_folder as id_folde1_11_1_, folder1_.id_parent_folder as id_paren2_11_1_, folder1_.name as name3_11_1_, folder1_.created as created4_11_1_, folder1_.modified as modified5_11_1_, folder1_.created_by as created_6_11_1_, folder1_.modified_by as modified7_11_1_ from folders_documents folders0_ inner join public.folder folder1_ on folders0_.id_folder=folder1_.id_folder where folders0_.id_document=?
Hibernate: select documentri0_.id_document as id_docum3_8_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_document=?
Hibernate: select results0_.id_document as id_docum3_8_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_document=?
Hibernate: select queries0_.id_user as id_user2_22_0_, queries0_.id_query as id_query1_16_0_, queries0_.id_query as id_query1_16_1_, queries0_.id_user as id_user2_16_1_, queries0_.query_string as query_st3_16_1_, queries0_.name as name4_16_1_, queries0_.description as descript5_16_1_, queries0_.is_public as is_publi6_16_1_, queries0_.is_automatic as is_autom7_16_1_ from public.nsquery queries0_ where queries0_.id_user=?
Hibernate: select results0_.id_user as id_user2_22_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_user=?
Hibernate: select childfolde0_.id_parent_folder as id_paren2_11_0_, childfolde0_.id_folder as id_folde1_11_0_, childfolde0_.id_folder as id_folde1_11_1_, childfolde0_.id_parent_folder as id_paren2_11_1_, childfolde0_.name as name3_11_1_, childfolde0_.created as created4_11_1_, childfolde0_.modified as modified5_11_1_, childfolde0_.created_by as created_6_11_1_, childfolde0_.modified_by as modified7_11_1_ from public.folder childfolde0_ where childfolde0_.id_parent_folder=?
Hibernate: select documents0_.id_folder as id_folde2_11_0_, documents0_.id_document as id_docum1_1_0_, document1_.id_document as id_docum1_8_1_, document1_.name as name2_8_1_, document1_.webform as webform3_8_1_, document1_.content as content4_8_1_, document1_.tag_clouds as tag_clou5_8_1_, document1_.summary as summary6_8_1_, document1_.created as created7_8_1_, document1_.modified as modified8_8_1_, document1_.created_by as created_9_8_1_, document1_.modified_by as modifie10_8_1_ from folders_documents documents0_ inner join public.document document1_ on documents0_.id_document=document1_.id_document where documents0_.id_folder=?
Hibernate: select folderrigh0_.id_folder as id_folde3_11_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_folder=?
Hibernate: select childfolde0_.id_parent_folder as id_paren2_11_0_, childfolde0_.id_folder as id_folde1_11_0_, childfolde0_.id_folder as id_folde1_11_1_, childfolde0_.id_parent_folder as id_paren2_11_1_, childfolde0_.name as name3_11_1_, childfolde0_.created as created4_11_1_, childfolde0_.modified as modified5_11_1_, childfolde0_.created_by as created_6_11_1_, childfolde0_.modified_by as modified7_11_1_ from public.folder childfolde0_ where childfolde0_.id_parent_folder=?
Hibernate: select documents0_.id_folder as id_folde2_11_0_, documents0_.id_document as id_docum1_1_0_, document1_.id_document as id_docum1_8_1_, document1_.name as name2_8_1_, document1_.webform as webform3_8_1_, document1_.content as content4_8_1_, document1_.tag_clouds as tag_clou5_8_1_, document1_.summary as summary6_8_1_, document1_.created as created7_8_1_, document1_.modified as modified8_8_1_, document1_.created_by as created_9_8_1_, document1_.modified_by as modifie10_8_1_ from folders_documents documents0_ inner join public.document document1_ on documents0_.id_document=document1_.id_document where documents0_.id_folder=?
Hibernate: select folderrigh0_.id_folder as id_folde3_11_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_folder=?
Hibernate: select user0_.id_user as id_user1_22_0_, user0_.id_user_profile as id_user_2_22_0_, user0_.name as name3_22_0_, user0_.firstname as firstnam4_22_0_, user0_.email as email5_22_0_, user0_.login as login6_22_0_, user0_.password as password7_22_0_, user0_.created as created8_22_0_, user0_.modified as modified9_22_0_, user0_.created_by as created10_22_0_, user0_.modified_by as modifie11_22_0_, user0_.avatar_filename as avatar_12_22_0_, user0_.state as state13_22_0_ from public.user user0_ where user0_.id_user=?
Hibernate: select userprofil0_.id_user_profile as id_user_1_23_0_, userprofil0_.name as name2_23_0_, userprofil0_.description as descript3_23_0_, userprofil0_.created as created4_23_0_, userprofil0_.modified as modified5_23_0_, userprofil0_.created_by as created_6_23_0_, userprofil0_.modified_by as modified7_23_0_ from public.user_profile userprofil0_ where userprofil0_.id_user_profile=?
Hibernate: select comments0_.user_id as user_id2_22_0_, comments0_.id as id1_4_0_, comments0_.id as id1_4_1_, comments0_.user_id as user_id2_4_1_, comments0_.answered_id as answered3_4_1_, comments0_.article_id as article_4_4_1_, comments0_.comment as comment5_4_1_, comments0_.creation_time as creation6_4_1_, comments0_.likecount as likecoun7_4_1_, comments0_.modification_time as modifica8_4_1_, comments0_.spam as spam9_4_1_, comments0_.spamcount as spamcou10_4_1_ from public.comment comments0_ where comments0_.user_id=?
Hibernate: select commentrep0_.user_id as user_id2_22_0_, commentrep0_.id as id1_5_0_, commentrep0_.id as id1_5_1_, commentrep0_.user_id as user_id2_5_1_, commentrep0_.comment_id as comment_3_5_1_, commentrep0_.reporttype as reportty4_5_1_ from public.commentreport commentrep0_ where commentrep0_.user_id=?
Hibernate: select communitie0_.id_user as id_user1_22_0_, communitie0_.id_community as id_commu2_0_0_, community1_.id_community as id_commu1_6_1_, community1_.id_community_profile as id_commu2_6_1_, community1_.name as name3_6_1_, community1_.description as descript4_6_1_, community1_.created as created5_6_1_, community1_.modified as modified6_6_1_, community1_.created_by as created_7_6_1_, community1_.modified_by as modified8_6_1_, community1_.state as state9_6_1_ from communities_users communitie0_ inner join public.community community1_ on communitie0_.id_community=community1_.id_community where communitie0_.id_user=?
Hibernate: select articlerep0_.user_id as user_id2_22_0_, articlerep0_.id as id1_3_0_, articlerep0_.id as id1_3_1_, articlerep0_.user_id as user_id2_3_1_, articlerep0_.article_id as article_3_3_1_, articlerep0_.reporttype as reportty4_3_1_ from public.articlereport articlerep0_ where articlerep0_.user_id=?
Hibernate: select articles0_.creator_id as creator_2_22_0_, articles0_.id as id1_2_0_, articles0_.id as id1_2_1_, articles0_.creator_id as creator_2_2_1_, articles0_.article as article3_2_1_, articles0_.commentcount as commentc4_2_1_, articles0_.creation_time as creation5_2_1_, articles0_.dislikecount as dislikec6_2_1_, articles0_.editingpassword as editingp7_2_1_, articles0_.likecount as likecoun8_2_1_, articles0_.picture_filename as picture_9_2_1_, articles0_.rootcommentcount as rootcom10_2_1_, articles0_.title as title11_2_1_, articles0_.totallikecount as totalli12_2_1_, articles0_.websitelink as website13_2_1_ from public.article articles0_ where articles0_.creator_id=?
Hibernate: select folderrigh0_.id_user as id_user2_22_0_, folderrigh0_.id_folder_right as id_folde1_12_0_, folderrigh0_.id_folder_right as id_folde1_12_1_, folderrigh0_.id_user as id_user2_12_1_, folderrigh0_.id_folder as id_folde3_12_1_, folderrigh0_.begin_access_date as begin_ac4_12_1_, folderrigh0_.end_access_date as end_acce5_12_1_, folderrigh0_.type_of_access as type_of_6_12_1_ from public.folder_right folderrigh0_ where folderrigh0_.id_user=?
Hibernate: select documentri0_.id_user as id_user2_22_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_user=?
Hibernate: select queries0_.id_user as id_user2_22_0_, queries0_.id_query as id_query1_16_0_, queries0_.id_query as id_query1_16_1_, queries0_.id_user as id_user2_16_1_, queries0_.query_string as query_st3_16_1_, queries0_.name as name4_16_1_, queries0_.description as descript5_16_1_, queries0_.is_public as is_publi6_16_1_, queries0_.is_automatic as is_autom7_16_1_ from public.nsquery queries0_ where queries0_.id_user=?
Hibernate: select results0_.id_user as id_user2_22_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_user=?
Hibernate: select childfolde0_.id_parent_folder as id_paren2_11_0_, childfolde0_.id_folder as id_folde1_11_0_, childfolde0_.id_folder as id_folde1_11_1_, childfolde0_.id_parent_folder as id_paren2_11_1_, childfolde0_.name as name3_11_1_, childfolde0_.created as created4_11_1_, childfolde0_.modified as modified5_11_1_, childfolde0_.created_by as created_6_11_1_, childfolde0_.modified_by as modified7_11_1_ from public.folder childfolde0_ where childfolde0_.id_parent_folder=?
Hibernate: select documentri0_.id_user as id_user2_22_0_, documentri0_.id_document_right as id_docum1_9_0_, documentri0_.id_document_right as id_docum1_9_1_, documentri0_.id_user as id_user2_9_1_, documentri0_.id_document as id_docum3_9_1_, documentri0_.begin_access_date as begin_ac4_9_1_, documentri0_.end_access_date as end_acce5_9_1_ from public.document_right documentri0_ where documentri0_.id_user=?
Hibernate: select queries0_.id_user as id_user2_22_0_, queries0_.id_query as id_query1_16_0_, queries0_.id_query as id_query1_16_1_, queries0_.id_user as id_user2_16_1_, queries0_.query_string as query_st3_16_1_, queries0_.name as name4_16_1_, queries0_.description as descript5_16_1_, queries0_.is_public as is_publi6_16_1_, queries0_.is_automatic as is_autom7_16_1_ from public.nsquery queries0_ where queries0_.id_user=?
Hibernate: select results0_.id_query as id_query4_16_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_query=?
Hibernate: select results0_.id_query as id_query4_16_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_query=?
Hibernate: select results0_.id_query as id_query4_16_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_query=?
Hibernate: select results0_.id_user as id_user2_22_0_, results0_.id_result as id_resul1_19_0_, results0_.id_result as id_resul1_19_1_, results0_.id_user as id_user2_19_1_, results0_.id_document as id_docum3_19_1_, results0_.id_query as id_query4_19_1_, results0_.score as score5_19_1_ from public.result results0_ where results0_.id_user=?
1


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Mon Dec 07, 2015 12:03 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
It depends on how you implement the ArticleDao.

This can happen if you run a query like this:

Code:
select o from Object;


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Mon Dec 07, 2015 1:09 pm 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
Thank you your response but:

This my findall dao method
Code:
@Override
   public List<T> findAll() {
           
      List<T> lReturn = null;
      StringBuffer queryBuffer = new StringBuffer(ApplicationConstants.FROM_);
      queryBuffer.append(classname);
      try {
                       startOperation();
         lReturn = mySession.createQuery(queryBuffer.toString()).list();
      } catch (HibernateException ex) {
         
         throw ex;
      } catch (Exception ex) {
         

      }

      //finally {
      //   HibernateFactory.close(mySession);
      //}
      return lReturn;

   }


I give you an other example of my dao method (findById)

Code:
        @Override
   public T findById(ID id) {

            T lReturn=null;
      try {
                       startOperation();
         lReturn= (T) mySession.get(entityClass, id);
      } catch (HibernateException ex) {
          handleException(ex);
                       
      } catch (Exception ex) {

      }
                //finally {
         // HibernateFactory.close(mySession);
      //}
                return lReturn;
   }


this is my mapping file (Article.hbm.xml)
Code:
<?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">
<!-- Generated 17 d?c. 2013 15:09:57 by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
  <class name="com.nsium.nscloud.dal.model.Article" lazy="false" schema="public" table="article">
    <id name="id" type="long">
      <column name="id"/>
      <generator class="identity"/>
    </id>
    <many-to-one class="com.nsium.nscloud.dal.model.User" fetch="select" name="creator">
      <column name="creator_id"/>
    </many-to-one>
    <property name="article" type="string">
      <column name="article"/>
    </property>
    <property name="commentcount" type="int">
      <column name="commentcount"/>
    </property>
    <property name="creationTime" type="date">
      <column name="creation_time"/>
    </property>
    <property name="dislikecount" type="int">
      <column name="dislikecount"/>
    </property>
    <property name="editingpassword" type="string">
      <column name="editingpassword"/>
    </property>
    <property name="likecount" type="int">
      <column name="likecount"/>
    </property>
    <property name="pictureFilename" type="string">
      <column name="picture_filename"/>
    </property>
    <property name="rootcommentcount" type="int">
      <column name="rootcommentcount"/>
    </property>
    <property name="title" type="string">
      <column name="title"/>
    </property>
    <property name="totallikecount" type="int">
      <column name="totallikecount"/>
    </property>
    <property name="websitelink" type="string">
      <column name="websitelink"/>
    </property>
    <set inverse="true" name="comments" lazy="false">
      <key>
        <column name="article_id"/>
      </key>
      <one-to-many class="com.nsium.nscloud.dal.model.Comment"/>
    </set>
    <set inverse="true" name="articlereports" lazy="false">
      <key>
        <column name="article_id"/>
      </key>
      <one-to-many class="com.nsium.nscloud.dal.model.ArticleReport"/>
    </set>
  </class>
</hibernate-mapping>



Thanks In advance;
Best regards


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Mon Dec 07, 2015 1:15 pm 
Regular
Regular

Joined: Mon Oct 19, 2015 7:49 am
Posts: 61
Location: ChengDu China
Of course, because you didn't use the lazy properties, please

change ALL the
lazy="false"
to
lazy="true".


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Mon Dec 07, 2015 2:44 pm 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
Nice it works,

I changed lazy because i had LazyInitializationException late loading (chargement tardif)
I was reading this tutorial before receive your answer
http://www.touilleur-express.fr/2009/03/03/hibernate-gerer-le-chargement-des-associations-efficacement/

Best regards,


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Tue Dec 08, 2015 11:45 am 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
This doessn't working when runing my web app application,

mode debug ==> look object collection set ==> LazyInitializationException

I'm trying this filter ConnectionFilter {http://www.javacodegeeks.com/2012/07/four-solutions-to-lazyinitializationexc_05.html}

echec of run

I don't use SPRING framework


Thank in advance


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Tue Dec 08, 2015 12:01 pm 
Regular
Regular

Joined: Mon Oct 19, 2015 7:49 am
Posts: 61
Location: ChengDu China
Four ways to resolve your problem

(1) Open session with long lifecylce, open it early enough and close it late enough, save it in an global thread local variable so that other modules can share the session from that thread local variable. if you can let all the operations about object accessing are during the lifecycle of the session, LazyInitializationException will not be thrown. This is called "session propagation", it is shown by a book that's wrote by the core developers of hibernate.

(2) JPA supports the javax.persistence.EntityGraph from 2.1, it can be used to decide fetch associations or not

(3) Increase your work, such as
Code:
public void List<EntityA> getEntityAs() {
     ....createQuery("from EntityA...")...
}
public void List<EntityA> getEntityAsAndFetchEntityBs() {
     ....createQuery("from EntityA... a left join fetch a.entityBs")...
}
public void List<EntityA> getEntityAsAndFetchEntityBsAndEntityCs() {
     ....createQuery("from EntityA... a left join fetch a.entityBs b left join b.entityCs c")...
}


(4) Use my framework, visit "https://github.com/babyfish-ct/babyfish", see the "tutorial.html", go to the chapter about "QueryPath"


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Tue Dec 08, 2015 12:21 pm 
Regular
Regular

Joined: Mon Oct 19, 2015 7:49 am
Posts: 61
Location: ChengDu China
You said your app is web app. it's not hard to do that, this is the simplest way


Code:
public class SessionContext {
     private static fianl SessionFactory sessionFactory;
     private static ThreadLocal<Session> sessionLocal = new ThreadLocal<>();
     private SessionContext() {
     }
     public static void createSession() { //only used by web filter
         if (sessionLocal.get() != null) {
               throw new IllegalStateException("The session is already created");
         }
         sessionLocal.set(sessionFactory.openSession());
     }
     public static void destroySession() { //Only used by web filter
         Session session = this.sessionLocal.get();
         this.sessionLocal.remove();
         if (session != null) {
             session.close();
         }
     }
     public static Session getSession() { //Used by any modules
          return this.sessionLocal.get();
     }
     static {
           sessionFactory = .....;
     }
}

Code:
public class HibernateFilter implements Filter {

      void doFilter(HttpServletRequest request, HttpServletResponse reponse, FilterChain chain) throws .... {
            SessionContext.createSession();
            try {
                  chain.doFilter(request, response);
            } finally {
                  SessionContext.close();
            }
      }
}


Then you can use "SessionContext.getSession()" whereever.

Note: This solution will cause a performance issue named "N + 1 query", in order to avoid it, please configure the attribute "batch" for collection properties, such as
Code:
<set name="childObjects" lazy="true" batch="20"/>


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Tue Dec 08, 2015 1:33 pm 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
I tried this solution:

https://github.com/arey/hibernate-hydrate

But the in few pages hibernate select always all datas (fetch=true)


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Tue Dec 08, 2015 1:59 pm 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
I must analyse the fetch="select" in all set of mapping hbm file.

after i'll try yoyr solution

if you have a proto type sample SessionContext
Best regards,

For information:
I use two hibernate cfg file

this my HibernateFactory class

Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.nsium.nscloud.dal.util;

/**
*
* @author Administrateur
*/
import com.nsium.nscloud.dal.dao.impl.CustomerDAOImpl;
import com.nsium.nscloud.dal.dao.interf.CustomerDAO;
import com.nsium.nscloud.dal.exeption.DataAccessLayerException;
import com.nsium.nscloud.dal.model.Customer;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import org.apache.commons.logging.*;
import org.hibernate.*;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateFactory {
   
    private static SessionFactory sessionFactoryNSCloudDb;
    private static Log log = LogFactory.getLog(HibernateFactory.class);
    public static HashMap<Integer,SessionFactory> myDictMapSSessionFactory=new HashMap<>();
   

    /**
     * Constructs a new Singleton SessionFactory
     * @return
     * @throws HibernateException
     */
    public static SessionFactory buildSessionFactory(String myHiberntCfgFile, Integer pLogCode) throws HibernateException {
        if (pLogCode<0) {
            closeFactory(sessionFactoryNSCloudDb);
        }
        else
        {
            SessionFactory lSessionFactory = getSessionFactoryByLogCode(pLogCode);
            if(lSessionFactory != null)
                closeFactory(lSessionFactory);
        }
           
        return configureSessionFactory(myHiberntCfgFile,pLogCode);
    }
   
    private static SessionFactory getSessionFactoryByLogCode(Integer pLogCode)
    {
        if(myDictMapSSessionFactory.containsKey(pLogCode))
            return myDictMapSSessionFactory.get(pLogCode);
       
        return null;
    }
   
    private static void deleteSessionFactory(Integer pLogCode)
    {
        if(myDictMapSSessionFactory.containsKey(pLogCode))
            myDictMapSSessionFactory.remove(pLogCode);
    }

    /**
     * Builds a SessionFactory, if it hasn't been already.
     */
    public static SessionFactory buildIfNeeded(Integer pLogCode) throws DataAccessLayerException{
       
        String lHiberntCfgFile;
                if (pLogCode == -1)
        {
            lHiberntCfgFile = ApplicationConstants.NSCLOUD_HBCONFIG_FILE;
        } else {
            lHiberntCfgFile = ApplicationConstants.GUID_HBCONFIG_FILE;
        }
        if (sessionFactoryNSCloudDb != null && pLogCode<0)
        {
            return sessionFactoryNSCloudDb;
        }
        else if(sessionFactoryNSCloudDb != null && pLogCode>0)
        {
            SessionFactory lSessionFactory = getSessionFactoryByLogCode(pLogCode);
           
            if(lSessionFactory != null)       
                return lSessionFactory;
        }
       
        try
        {
           return configureSessionFactory(lHiberntCfgFile, pLogCode);
        }
        catch (HibernateException e)
        {
            throw new DataAccessLayerException(e);
        }
    }
   
    public static SessionFactory getSessionFactory() {
        return sessionFactoryNSCloudDb;
    }
   

    public static Session openSession(Integer pLogCode) throws HibernateException {
       
       
        SessionFactory lSessionFactory = buildIfNeeded(pLogCode);
        if(lSessionFactory != null)
            return lSessionFactory.openSession();
        else
            return null;
    }
   
    public static Session openSession(Dictionary pProperties,Integer pLogCode) throws HibernateException {
       
        SessionFactory lSessionFactory = buildIfNeeded(pLogCode);
       
        if(lSessionFactory != null)
            return lSessionFactory.openSession();
       
        return null;
    }

    public static void closeFactory(SessionFactory pSessionFatory) {
        if (pSessionFatory != null) {
            try {
                pSessionFatory.close();
            } catch (HibernateException ignored) {
                log.error("Couldn't close SessionFactory", ignored);
            }
        }
    }

    public static void close(Session session) {
        if (session != null) {
            try {
                session.close();
            } catch (HibernateException ignored) {
                log.error("Couldn't close Session", ignored);
            }
        }
    }

    public static void rollback(Transaction tx) {
        try {
            if (tx != null) {
                tx.rollback();
            }
        } catch (HibernateException ignored) {
            log.error("Couldn't rollback Transaction", ignored);
        }
    }
    /**
     *
     * @return
     * @throws HibernateException
     */
    private static SessionFactory configureSessionFactory(String myHiberntCfgFile,Integer pLogCode) throws HibernateException {
       
        //try {
        Configuration configuration = new Configuration();
       
        if(pLogCode<0)
        {
           
            configuration.configure(myHiberntCfgFile);
            ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
           
            sessionFactoryNSCloudDb = configuration.buildSessionFactory(serviceRegistry);
            return sessionFactoryNSCloudDb;
        }
        else
        {
            Dictionary props = new Hashtable<String,Object>();
            CustomerDAO lCustomerDAO = new CustomerDAOImpl(-1);
           
           // Customer lCustomer=lCustomerDAO.findByLogCode(pLogCode);
           Customer lCustomer;
            lCustomer = lCustomerDAO.findByAttribute(ApplicationConstants.LOGCODE_PROPERTY, pLogCode).get(0);
           

            if(lCustomer!=null)
            {
                Iterator<com.nsium.nscloud.dal.model.Connection> lIterator=lCustomer.getConnections().iterator();
                com.nsium.nscloud.dal.model.Connection lConnection= lIterator.next();

                if(lConnection!=null)
                {
                    String lConnectionString=lConnection.getConnectionString();

                    if(lConnectionString!=null && !lConnectionString.isEmpty())
                    {
                       
                        String lURL ="";
                        String lUserName="";
                        String lPassword = "";
                                               
                        String[] lConnectionInfo = lConnectionString.split(";");                       
                       
                        if(lConnectionInfo.length==3)
                        {
                            lURL =lConnectionInfo[0];
                            lUserName = lConnectionInfo[1];
                            lPassword = lConnectionInfo[2];
                        }
                       
                        configuration.configure(myHiberntCfgFile)
                                .setProperty("hibernate.connection.url",lURL)
                                .setProperty("hibernate.connection.username",lUserName)
                                .setProperty("hibernate.connection.password",lPassword);
                       
                       
            ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
                       
            SessionFactory lSessionFactory = configuration.buildSessionFactory(serviceRegistry);
                        myDictMapSSessionFactory.put(pLogCode, lSessionFactory);
                        return lSessionFactory;
                    }
                }
            }
        }       
      //  } catch (Throwable th) {
                  //  System.err.println("Enitial SessionFactory creation failed" + th);
                    //throw new ExceptionInInitializerError(th);
            //}finally
        //{
            return null;
        //}
       
       
    }
}




Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Wed Dec 09, 2015 6:10 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
You do realize that you implemented your DAO class to load it all right?

A list() operation on all types means that you want to select them all. Don't do that if you don't want it to.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Why Hibernate select all table's data when I run
PostPosted: Wed Dec 09, 2015 6:34 am 
Newbie

Joined: Mon Dec 07, 2015 9:54 am
Posts: 8
I give you those code source to illustre infos:

This is my ArticleDAO interface:

Code:
package com.nsium.nscloud.dal.dao.interf;

import java.util.List;

import com.nsium.nscloud.dal.model.Article;


public interface ArticleDAO extends GenericDAO<Article,Long > {
   public List<Article> findByParams(boolean orderbylikes, boolean orderbycreation, Integer maxResults, Integer firstResult);
}


This my GenericDAO Interface

Code:
package com.nsium.nscloud.dal.dao.interf;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface GenericDAO<T, ID> {
   
        public T create(T entity);

   public void delete(T entity);
       
        public void deleteAll(List<T> entity);

   public T update(T entity);

   public T findById(ID id);

   public List<T> findAll();

   public List<T> findAll(int maxResults, int firstResult);
       
        public List<T> findAll(Object pOrderBy, String pOrederType);
       
        public List<T> findAll(Object pOrderBy, String pOrederType,int maxResults, int firstResult);

   public List<T> findByAttribute(String attribute, Object value);

   public List<T> findByAttributes(Map<String, Object> attributes);
   
   public List<T> findByAttributes(Map<String, Object> attributes, Integer maxResults, Integer firstResult);
       
        public void doIndex();
       
        public void reindex();
       
        public List<T> searchByLuc(String pField, String pQueryString);
       
        public List<T>searchByHbSearch(String pField, String pQueryString);
               
        public List<T> searchByCombineQuery(HashMap<String,String> pFieldsAndValues, int startingRowIndex, int numberOfRows);
       
        public List<T> searchByRangeQuery(String pField, String pStartDate, String pEndDate, boolean pIncludeStart,boolean pIncludeEnd);

        public int countTotalRecord(HashMap<String,String> pFieldsAndValues);

}



This is my ArticleDAOImpl class

Code:
package com.nsium.nscloud.dal.dao.impl;

import com.javaetmoi.core.persistence.hibernate.LazyLoadingUtil;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;

import com.nsium.nscloud.dal.dao.interf.ArticleDAO;
import com.nsium.nscloud.dal.model.Article;
import com.nsium.nscloud.dal.util.ApplicationConstants;
import com.nsium.nscloud.dal.util.HibernateFactory;
import javax.faces.bean.ManagedBean;

//import com.utils.HibernateUtil;

//@Named(value = "ArticleDAO")
@ManagedBean(name="ArticleEAO")

public class ArticleDAOImpl extends GenericDAOImpl<Article, Long> implements ArticleDAO {
   
     public ArticleDAOImpl(Integer pLogCode) {
        super(pLogCode);
    }
   @Override
   public List<Article> findByParams(boolean pOrderbylikes,
         boolean pOrderbycreation, Integer pMaxResults, Integer pFirstResult) {

      List<Article> articles = null;
      //Session session = (Session) NewHibernateUtil.getSession();
                super.startOperation();

      StringBuffer queryBuffer = new StringBuffer(ApplicationConstants.FROM_);
      queryBuffer.append("Article");

      if (pOrderbycreation == true) {
         queryBuffer.append(" order by creation_time DESC");
      } else {
         if (pOrderbylikes == true) {
            queryBuffer.append(" order by totallikecount DESC");
         }
      }

      try {
         Query query = mySession.createQuery(queryBuffer.toString());
         if (pMaxResults != null) {
            query.setMaxResults(pMaxResults);
         }

         if (pFirstResult != null) {
            query.setFirstResult(pFirstResult);
         }

         articles = query.list();

      } catch (HibernateException ex) {
                        handleException(ex);
         ex.printStackTrace();
         // logger.error(HIBERNATE_EXCEPTION_IN_GET_OBJECTS_STRING, ex);
         throw ex;
      } catch (Exception ex) {
         ex.printStackTrace();
         // logger.error(EXCEPTION_IN_GET_OBJECTS_STRING, ex);
         // throw ex;
      }

      finally {
                         LazyLoadingUtil.deepHydrate(mySession, articles);
          HibernateFactory.close(mySession);
      }
      return articles;
      /*
       * StringBuilder JPQL_SELECT = new StringBuilder();
       *
       * JPQL_SELECT.append("select a from Article a where 1=1");
       *
       * TypedQuery<Article> typedQuery =
       * em.createQuery(JPQL_SELECT.toString(), Article.class);
       *
       * return typedQuery.getResultList();
       */}

}


This my GenericDAOImpl class

Code:
package com.nsium.nscloud.dal.dao.impl;

import com.javaetmoi.core.persistence.hibernate.LazyLoadingUtil;
import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.nsium.nscloud.dal.dao.interf.GenericDAO;
import com.nsium.nscloud.dal.exeption.DataAccessLayerException;
import com.nsium.nscloud.dal.util.ApplicationConstants;
import com.nsium.nscloud.dal.util.DaoSession;
import com.nsium.nscloud.dal.util.HibernateFactory;
import com.nsium.nscloud.dal.util.StringUtils;
import java.io.Serializable;
import java.sql.Connection;
import java.util.logging.Level;
import javax.faces.bean.ManagedProperty;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.CachingWrapperFilter;
import org.apache.lucene.search.QueryWrapperFilter;
import org.apache.lucene.search.TermRangeQuery;
import org.hibernate.search.FullTextQuery;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.MassIndexer;
import org.hibernate.search.Search;
import org.hibernate.search.SearchFactory;
import org.hibernate.search.query.dsl.BooleanJunction;
import org.hibernate.search.query.dsl.QueryBuilder;

//import com.utils.HibernateUtil;
//import com.utils.StringUtils;
@SuppressWarnings("unchecked")
public abstract class GenericDAOImpl<T, ID extends Serializable> implements GenericDAO<T,ID> {

   // unitName ist Optional
   /*
    * @PersistenceContext(unitName = "commentboxDB") EntityManager em;
    */
   protected String classname;
   protected Class<T> entityClass;
        protected Session mySession;
        protected Transaction myTransaction;
   private String country;
        protected Integer myLogCode;
        protected String myHiberntCfgFile;
       

   public void initQuerys() {
      // Nothing to do here ?
   }

   @SuppressWarnings("unchecked")
   public GenericDAOImpl(Integer pLogcode) {
           
           
            myLogCode=pLogcode;
            HibernateFactory.buildIfNeeded(myLogCode);

      try {

         ParameterizedType pt = (ParameterizedType) getClass()
               .getGenericSuperclass();
         // You may need this split or not, use logging to check

         String parameterClassName = pt.getActualTypeArguments()[0]
               .toString().split("\\s")[1];

         // Instantiate the Parameter and initialize it.
         entityClass = (Class<T>) Class.forName(parameterClassName);

         classname = entityClass.getName().substring(
               entityClass.getName().lastIndexOf(".") + 1);

      } catch (ClassNotFoundException e) {
         Logger.getLogger(this.getClass().toString()).info(e.getMessage());
      }
   }

       
    protected void startOperation() throws HibernateException
    {
        mySession = HibernateFactory.openSession(myLogCode);
       // mySession = HibernateFactory.openSession();
        myTransaction = mySession.beginTransaction();
    }
       
       
       
        protected void handleException(HibernateException e) throws DataAccessLayerException {
        HibernateFactory.rollback(myTransaction);
        throw new DataAccessLayerException(e);

        }
        @Override
   public T create(T save)
        {
        try
        {
            startOperation();
            mySession.save(save);
            myTransaction.commit();
            mySession.refresh(save);
        } catch (HibernateException e)
        {
            handleException(e);
        } //finally { 
            //HibernateFactory.close(mySession);
       // }
            return save;
   }

        @Override
   public void delete(T entity)
        {
           
            try
            {
            startOperation();
            mySession.delete(entity);
            myTransaction.commit();
            }
            catch (HibernateException e)
             {
            handleException(e);
             }
            //finally
            //{
           // HibernateFactory.close(mySession);
            //}
   }
       
        @Override
        public void deleteAll(List<T> entities)
        {
            try
            {
            startOperation();
            for(T entity:entities)
            {
             mySession.delete(entity);
            }
            myTransaction.commit();
            }
            catch (HibernateException e)
             {
            handleException(e);
             }
           // finally
            //{
            //HibernateFactory.close(mySession);
            //}
   }

        @Override
   public T update(T entity) {
            try {
            startOperation();
            mySession.flush();
            mySession.saveOrUpdate(entity);
            myTransaction.commit();
            mySession.refresh(entity);
        } catch (HibernateException e) {
            handleException(e);
        } //finally {
           // HibernateFactory.close(mySession);
        //}
      return entity;
      // TODO doubt whether return entity directly or fetch from database

   }

        @Override
   public T findById(ID id) {

            T lReturn=null;
      try {
                       startOperation();
         lReturn= (T) mySession.get(entityClass, id);
      } catch (HibernateException ex) {
          handleException(ex);
                       
      } catch (Exception ex) {

      }
                //finally {
         // HibernateFactory.close(mySession);
      //}
                return lReturn;
   }

        @Override
   public List<T> findAll() {
           
      List<T> lReturn = null;
      StringBuffer queryBuffer = new StringBuffer(ApplicationConstants.FROM_);
      queryBuffer.append(classname);
      try {
                       startOperation();
         lReturn = mySession.createQuery(queryBuffer.toString()).list();
      } catch (HibernateException ex) {
         
         throw ex;
      } catch (Exception ex) {
         

      }

      //finally {
      //   HibernateFactory.close(mySession);
      //}
      return lReturn;

   }

        @Override
   public List<T> findAll(int maxResults, int firstResult) {

      
      List<T> lReturn = null;
      StringBuffer queryBuffer = new StringBuffer(ApplicationConstants.FROM_);
      queryBuffer.append(classname);
      try {
                        startOperation();
         Query query = mySession.createQuery(queryBuffer.toString());
         query.setMaxResults(maxResults);
         query.setFirstResult(firstResult);

         lReturn = query.list();

      } catch (HibernateException ex) {
         
         // logger.error(HIBERNATE_EXCEPTION_IN_GET_OBJECTS_STRING, ex);
         throw ex;
      } catch (Exception ex) {
         
         // logger.error(EXCEPTION_IN_GET_OBJECTS_STRING, ex);
         // throw ex;
      }

      //finally {
      //   HibernateFactory.close(mySession);
      //}
      return lReturn;

   }
       
       @Override
       public List<T> findAll(Object pOrderBy, String pOrderType)
       {
       List lReturn = null;
       try {
            startOperation();
            Query query = mySession.createQuery(ApplicationConstants.FROM_ + classname + ApplicationConstants._ORDER_BY_ + pOrderBy + pOrderType);
            lReturn = query.list();
       } catch (HibernateException e) {
            handleException(e);
       }
       //finally {
          //  HibernateFactory.close(mySession);
       //}
        return lReturn;
       }
       
       @Override
       public List<T> findAll(Object pOrderBy, String pOrderType,int maxResults, int firstResult)
       {
       List<T> lReturn = null;
      StringBuffer queryBuffer = new StringBuffer(ApplicationConstants.FROM_);
      queryBuffer.append(classname).append(ApplicationConstants._ORDER_BY_)
                           .append(pOrderBy)
                           .append(pOrderType);
               
      try {
                        startOperation();
         Query query = mySession.createQuery(queryBuffer.toString());
         query.setMaxResults(maxResults);
         query.setFirstResult(firstResult);

         lReturn = query.list();

      } catch (HibernateException ex) {
         
         
      } catch (Exception ex) {

      }

      //finally {
         //HibernateFactory.close(mySession);
      //}
      return lReturn;

       }

   /**
    * Returns a list of Objects that match an attribute value
    *
    * @param attribute
    *            name of the bean property
    * @param value
    *            of the attribute
    */
        @Override
   public List<T> findByAttribute(String attribute, Object value) {

      Map<String, Object> searchCriteria = new HashMap<String, Object>();
      searchCriteria.put(attribute, value);

      StringBuffer whereClauseBuff = new StringBuffer(ApplicationConstants.FROM_);
      List<T> lReturn = null;
      whereClauseBuff.append(classname);
      if (searchCriteria != null && searchCriteria.size() > 0) {
         whereClauseBuff.append(ApplicationConstants._WHERE_);
         StringUtils.buildWhereClause(searchCriteria, whereClauseBuff, null);
      }

      
      try {
                        startOperation();
         //mySession.beginTransaction();
         Query query = mySession.createQuery(whereClauseBuff.toString());

         lReturn = (List<T>) query.list();
      } catch (HibernateException ex) {
         
         // logger.error(HIBERNATE_EXCEPTION_IN_GET_OBJECTS_MAP_STRING, ex);
         
      } catch (Exception ex) {
         
         // logger.error(EXCEPTION_IN_GET_OBJECTS_MAP_STRING, ex);
         // throw ex;
      }
                {
                         LazyLoadingUtil.deepHydrate(mySession, lReturn);
         HibernateFactory.close(mySession);
      }
      return lReturn;

      /*
       * try { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<T>
       * c = cb.createQuery(entityClass); Root<T> rootObj =
       * c.from(entityClass); List<T> objs = em.createQuery(
       * c.select(rootObj).where( cb.equal(rootObj.get(attribute), value)))
       * .getResultList();
       *
       * return objs; } catch (RuntimeException re) { throw re; }
       */
   }

   /**
    * Returns a list of Objects that match a list of attributes values.
    * Attributes can be compared to null by setting the name of a property and
    * null as value.
    *
    * @param attributes
    *            map that contains as the key values the name of the bean
    *            properties and as value the attribute value to be matched
    */
        @Override
   public List<T> findByAttributes(Map<String, Object> attributes) {
      return findByAttributes(attributes, null, null);
   }

   /**
    * Returns a list of Objects that match a list of attributes values.
    * Attributes can be compared to null by setting the name of a property and
    * null as value.
    *
    * @param attributes
    *            map that contains as the key values the name of the bean
    *            properties and as value the attribute value to be matched
    */
        @Override
   public List<T> findByAttributes(Map<String, Object> attributes,Integer maxResults, Integer firstResult)
        {

      StringBuffer whereClauseBuff = new StringBuffer(ApplicationConstants.FROM_);
      List<T> lReturn = null;
      whereClauseBuff.append(classname);
      if (attributes != null && attributes.size() > 0) {
         whereClauseBuff.append(ApplicationConstants._WHERE_);
         StringUtils.buildWhereClause(attributes, whereClauseBuff, null);
      }

      
      try {
                        startOperation();
         //mySession.beginTransaction();
         Query query = mySession.createQuery(whereClauseBuff.toString());

         // TODO added by mohit
         if (maxResults != null) {
            query.setMaxResults(maxResults);
         }

         if (firstResult != null) {
            query.setFirstResult(firstResult);
         }

         lReturn = (List<T>) query.list();
      } catch (HibernateException ex) {
         
         // logger.error(HIBERNATE_EXCEPTION_IN_GET_OBJECTS_MAP_STRING, ex);
         throw ex;
      } catch (Exception ex) {
         
         // logger.error(EXCEPTION_IN_GET_OBJECTS_MAP_STRING, ex);
         // throw ex;
      }
                //finally {
         //HibernateFactory.close(mySession);
      //}
      return lReturn;

      /*
       * try {
       *
       * CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<T> c =
       * cb.createQuery(entityClass); Root<T> rootObj = c.from(entityClass);
       * CriteriaQuery<T> qry = c.select(rootObj);
       *
       * Predicate p = cb.conjunction();
       *
       * for (Entry<String, Object> entry : attributes.entrySet()) {
       *
       * if (entry.getValue() != null) p = cb.and( p,
       * cb.equal(rootObj.get(entry.getKey()), entry.getValue())); else p =
       * cb.and(p, cb.isNull(rootObj.get(entry.getKey()))); } qry.where(p);
       * TypedQuery<T> typedquery = em.createQuery(qry);
       *
       * if (maxResults != null) { typedquery.setMaxResults(maxResults); }
       *
       * if (firstResult != null) { typedquery.setFirstResult(firstResult); }
       *
       * List<T> objs = typedquery.getResultList();
       *
       * return objs; } catch (RuntimeException re) { throw re; }
       */
   }
}


thanks for advance,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.