1. Hibernate criteria/filtering - only return elements in collection that are specified in the criteria stackoverflow.comI have four hibernate classes: Trader, Legal, Party and Relation. Trader and Legal are types of party so extend it. A Trader can be related to a legal, a ... |
2. How can I filter related collection with "and" condition (Hibernate Criteria API) stackoverflow.comObject |
3. Hibernate criteria filter inner collection stackoverflow.comI have the next classes/tables: class User
class Work
|
4. Hibernate Criteria Collection of Objects stackoverflow.comI have a class with collection of Objects. Ex:
|
5. Criteria and specific collection elements forum.hibernate.org |
6. Criteria and indexed collections forum.hibernate.orgHi everyone, I got a mapping like this: |
7. Criteria API, negated criterion on nested Collections forum.hibernate.org |
8. Criteria and Collections forum.hibernate.orgI trid with: Code: Criteria criteria=session.createCriteria(HUtente.class); HUtente hu=new HUtente(); hu.username="i%"; Example example=Example.create(hu); example.ignoreCase(); example.enableLike(); example.excludeZeroes(); criteria.add(example); criteria.createCriteria("gruppi","x0").add(Expression.eq("id",new Long(1))); criteria.createCriteria("gruppi""x1").add(Expression.eq("id",new Long(3))); List list=criteria.list(); But i get: java.sql.SQLException: General error, message from server: "Unknown table 'x0' in where clause" :( :( :( The sql is: Code: select this.id as id3_, this.cognome as cognome3_, this.descrizioneRuolo as descrizi3_3_, this.grado as grado3_, this.nome as nome3_, this.password ... |
9. Criteria by Example, does it use collections... forum.hibernate.orgCat cat = new Cat(); cat.setSex('F'); cat.setColor(Color.BLACK); List results = session.createCriteria(Cat.class) .add( Example.create(cat) ) .list(); If cat.myCollection had some values in it, would those be used in the query? Or do you have to add an association criteria like so: Cat cat = new Cat(); cat.setSex('F'); cat.setColor(Color.BLACK); List results = session.createCriteria(Cat.class) .add( Example.create(cat) ) .createCriteria("kittens") .add( Expression.like("name", "F%") .list(); ? |
10. criteria across collections and OR forum.hibernate.orgI tried that, it's not quite what I'm looking for. The expression you gave is the equivalent of an AND. It returns records where the company name matches AND either the first or last name match. I'm looking for a 3 way OR. Either the first name OR the last name OR the company name could match. The idea is that ... |
11. Differenct sub-criterias on the same collection forum.hibernate.orgSELECT Person FROM Person As Pers WHERE Pers.Id in (SELECT PersonId FROM Address as Adr WHERE Adr.City = 'Moscow' AND Adr.Type = 1) AND Pers.Id in (SELECT PersonId FROM Address as ... |
12. Is it possible to filter a collection within a criteria? forum.hibernate.orgI have a parent/child relationship where I want to use a criteria query to find results based on attributes within the children. Then I want to return the matching parents with their children filtered to only the matching children. Is this possible? So let's say the child class that has an attribute of hairColor. I want to search for parent objects ... |
13. Using Criteria.addOrder() with collections? forum.hibernate.orgI develop an admissions decision suppport system for use by tutors at a university with a collegiate system. Applicants ("candidates") specify a preferential order of colleges at which they wish to take their course, although it is not necessary to specify second or higher college preferences. Tutors are affiliated with colleges, and are often interested to see a list of all ... |
14. Criteria and collections of elements forum.hibernate.orgI have a class ContractRequest that contains a map of |
15. Writing Criteria for Conjunction in a collection forum.hibernate.org |
16. Criteria and filtered collections - inconsistent behavior? forum.hibernate.orgHi, I have two tables: OWNER (ownerId, name) and CAR (carId,ownerId,color,make,model). Owner class looks like this: Owner{ownerId,name,cars}. Car class looks like this: Car{carId,owner,color,make,model}. As you can see, Car object has many-to-one relationship with Owner. I create Criteria object like this: Criteria c=session.createCriteria(Owner.class); c.add(Expression.eq("name","John")); And I add a filter on Car collection (name="colorFilter", param="color", condition="color=:color") like this: session.enableFilter("colorFilter").setParameter("color","red"); As of now I ... |
17. "Extra lazy" Collection with Criteria forum.hibernate.orgThanks. I was just thinking perhaps there was a way to make list() behave just like an extra lazy collection. That way you would be able to use subList(..) and size() for pagination. :) I'm on mysql now so I'm not sure ScrollableResult is a good idea. I'll just stick to setFirstResult/setMaxResults for now. |
18. Criteria API and Collections forum.hibernate.orgOk, I've spent a few hours searching forums, documentation, FAQ... and I am no closer to solving my problem. Simple scenario: @Entity class Customer { @OneToMany List |
19. Using Criteria API to recreate any elements(collection) forum.hibernate.orgI have been searching for 2 days to try to find this. Hopefully it is simple and I have just overlooked something. I have an object (Contact) with a Set element and I would like to use the Criteria API to limit search results to those results that have one of the elements of that Set in another Set. I will ... |
20. Hibernate criteria with parameters collections forum.hibernate.org |
21. Help with Criteria API and collections needed please forum.hibernate.orgSay I have the following classes: class Cat { List |
22. criteria and collections forum.hibernate.orgHi, I think you can try using Distinct clause. In criteria API you filter the retrieved list using import org.hibernate.transform.DistinctRootEntityResultTransformer; return new DistinctRootEntityResultTransformer().transformList(list); where list is the results u have got after executing Criteria. Important thing is doing distinct this way is totally different from having Distinct in select clause as SQL or HQL level, as here first you get the ... |