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