-->
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: HQL functions: index, maxindex, minindex
PostPosted: Tue Jun 10, 2008 6:38 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Hello,

I am trying to use the HQL functions like index, maxindex and minindex however Hibernate (or the IDE) is not recognising them.

For example from the documentation:
Code:
select item, index(item) from Order order
    join order.items item
where index(item) < 5

However I get an org.hibernate.MappingException stating that the Property index does not exist in the collection Order.items.

I am using Hibernate 3.2.4.sp1. Elcipse 3.3.2 running JBoss Tools 2.1.0.GA.

Is anyone using these functions? Does this sound more like an IDE / Jboss Tools problem?

Thanks,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 6:49 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Same result on the server so it's not the IDE.

Cheers,

Damian.


Top
 Profile  
 
 Post subject: [RESOLVED]
PostPosted: Tue Jun 10, 2008 7:05 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Found the problem / solution.

I had my collection defined as a List on the parent entity, but I had no @IndexColumn specified. As soon as I add this then all of these functions work.

Maybe it's a tip that could be added to the Hibernate EntityManager documentation in chapter 7.8?

Cheers,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 9:18 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Thanks for posting the solution!

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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.