-->
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: Criteria query: Restriction on a specific element in a list
PostPosted: Mon Feb 11, 2008 7:48 am 
Newbie

Joined: Mon Feb 11, 2008 7:29 am
Posts: 1
G'day

I'm currently on changing HQL statements into Criteria queries. In one of my existing HQL query I've got the following statement:

Code:
createQuery("FROM Machine machine WHERE machine.states[ maxindex(machine.states) ].stateName != 'New');


The query above returns all machine objects whose last state object in their state-list has a state name unequal "New".

How can I retrieve the same objects using a Criteria query?

Trying the code below results in a "could not resolve property: states[maxindex(states)]" error...

Code:
.createCriteria(Machine.class)
            .createAlias("states[maxindex(states)]", "s")
            .add(Expression.ne("s.stateName", "New"));



Any help is appreciated!

Thank you very much!

Regards
Sandro


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.