-->
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.  [ 1 post ] 
Author Message
 Post subject: keywords,one-to-many,join,bi-directional mapping, efficiency
PostPosted: Mon Nov 15, 2004 8:49 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 8:40 pm
Posts: 30
Location: SF Bay Area
Consider the following query :

from Branch branch where branch.state='AZ' and branch.branchId in
(select office.Branch from Office office where office.division='MN')

Background :

Branch and Office have a one to many relactionship.

Suppose a Branch object has a set of Offices and - because of
the bi-directional hbm mapping - an Office has a Branch object.

The HQL statement selects Branch objects having an Office
object having division='MN'


Questions :

1. Is this an efficient query?

2. Is there a better alternative to this query which returns
the same result?

(This query appears crude given all the clean ways Hibernate
offices to create queries. )

3. Is there a join style way to create this query? Sort of like

from Branch branch where branch.state='AZ'
and branch.offices.division='MN'

4. Is there a way to do this without using a bi-directional mapping?

Many thanks.


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

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.