-->
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: Query migration with elements(..)
PostPosted: Thu Apr 14, 2005 1:57 pm 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
Hibernate version: 3.0

We migrate our application from Hibenrnate 2.1.8 to 3.0 and we have a query with this form...

select A
from ItemA A, elements(A.childrens) B
where A.code = ? and B.reference = ?
order by index(B)

With this hibernate say

unexpected token: elements near line 1, column 70

Then, i read reference documentation and i found

Note that these constructs - size, elements, indices, minindex, maxindex, minelement, maxelement - may only be used in the where clause in Hibernate3.

My question is, how migrate my query ?, with join ?

regards
epsino


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 2:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
select A
from IteamA a join a.children b
where b.reference = ?
and a.code = ?
order by index(b)

and it will run much faster then the "elements" function

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 8:23 am 
Beginner
Beginner

Joined: Wed Aug 18, 2004 10:03 am
Posts: 28
Thanks !!!

But, why is much faster ?

regards
epsino


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.