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.  [ 4 posts ] 
Author Message
 Post subject: how to use hibernate with three more tables
PostPosted: Sat Oct 04, 2008 5:29 am 
Newbie

Joined: Sat Oct 04, 2008 5:22 am
Posts: 3
Location: INDIA
how to use hibernate criteria for using three more tables at a time


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2008 2:54 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
There is no limit in the number of tables that can be linked on a query, if this is correctly reflected in the mapping files.
You refer to additional tables using either an alias or a subcriteria.

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2008 5:34 pm 
Newbie

Joined: Mon May 05, 2008 10:34 am
Posts: 11
Location: Houston, TX
I needed to query for results based on data several levels deep in the relationship hierarchy. This is the code I used:

Code:
session.CreateCriteria(typeof(AppSection))
                               .CreateCriteria("AppRoleSectionAccess")
                               .CreateCriteria("Role")
                               .CreateCriteria("RoleMembers")
                               .CreateCriteria("User")
                               .Add(Expression.Eq("Id", user.Id))
                               .SetResultTransformer(new DistinctRootEntityResultTransformer())
                               .List<AppSection>())


Just change the result transformer to whatever suits your needs.


Top
 Profile  
 
 Post subject: How can i use this jdbc query from Hibernate criteria
PostPosted: Wed Oct 08, 2008 2:26 am 
Newbie

Joined: Sat Oct 04, 2008 5:22 am
Posts: 3
Location: INDIA
Hi to All
thanks for previous replies to kibbled_bits and gonzao_diaz
now my Query is

how can i use this jdbc Query from hibernate Criteria please give me reply. thanks in advance



query = "select * from glt_connections con,GLT_SYSTEM_ORG_ASSOIC ass where con.connection_id = ass.SYSTEM_ID and ass.ORG_ID=?";



Thanks,
Narasimha.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.