-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL query vs Criteria query
PostPosted: Fri May 21, 2004 1:36 pm 
Newbie

Joined: Wed May 19, 2004 11:50 pm
Posts: 9
<class name="Order" table="Order" >
<id name="ORDNUM" column="ORDNUM" >
<generator class="native">
</generator>
</id>
<property name="desc" column="desc" />
<many-to-one name="customer" column="customer_id"
outer-join="true" not-null="true" />
<bag name="items" lazy="true" inverse="true"
cascade="save- update">
<key column="item_Ord-no"/>
<one-to-many class="Item"/>
</bag>
</class>




HQL-
createQuery(
"from Order order "
+ " where order.ordnum = :no "
+ " order by order.ordnum desc")



Question-
Why does this not automatically retrieve customer without issuing an additional query? This needs 2 queries
If I use CriteriaAPI it works fine and need 1 query

thanks


Top
 Profile  
 
 Post subject: Ignore
PostPosted: Fri May 21, 2004 1:47 pm 
Newbie

Joined: Wed May 19, 2004 11:50 pm
Posts: 9
I figured out the issue
I had to give


From Order inner join fetch customer
...

thanks everyone


Top
 Profile  
 
 Post subject: Ignore
PostPosted: Fri May 21, 2004 2:44 pm 
Newbie

Joined: Wed May 19, 2004 11:50 pm
Posts: 9
I figured out the issue
I had to give


From Order inner join fetch customer
...

thanks everyone


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