element « Criteria « JPA Q&A





1. Hibernate criteria _ how to use criteria to return only one element of an object instead the entire object    stackoverflow.com

I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if ...

2. Hibernate Criteria for elements inside a Set    stackoverflow.com

I have one entity that contains a set of another entity. Entity1 contains Set entityTwos I want to create a search criteria for an "id" field inside entityTwos. I searched, but didn't get any ...

3. Criteria equivelant to HQLs in elements()    forum.hibernate.org

Hi, I have come up against a problem to which I can find no work-around. The ideal solution would be to have some sort of Criterion which replicates the beaviour of the HQL 'in elements()' clause. Something like: Code: mycriteria.add(Restrictions.inElements(value,"child.morechildren")); I've had a play with the Hibernate source code in the past (I spent ages creating a 'distinct' Restriction and then ...

4. Elements function with criteria    forum.hibernate.org

Hi! This works ok: select elements(group.Contacts) from Group group where group.GroupId = 7 But I need to add a criteria for the elements returned. If I only want to return the contacts with firstname = "tony" I write: select elements(group.Contacts) from Group group where 'tony' in elements(group.Contacts.FirstName) and group.GroupId = 7 This does not work and I get the exception: expecting ...