Hello there, I need to retrieve a property on the first item in a collection:
Code:
public class Order {
@OneToMany(mappedBy="order", targetEntity=Item.class)
private List<Item> items;
// Getter and setter
}
public class Item {
private Integer ID;
@ManyToOne(targetEntity=Order.class)
private Order order;
private Integer code;
// Getters and setters
}
I have tried:
Code:
executeHQLQuery("FROM Order AS order WHERE order.items[0].code = 5");
But I get the error:
Code:
org.springframework.orm.hibernate3.HibernateQueryException: unindexed fromElement before []
Any ideas? The join works fine when retrieving an Order normally.
Many thanks.