Filter « Fetch « JPA Q&A





1. Hibernate master-details: how to filter detail and fetch only master rows?    stackoverflow.com


what is the right way with Hibernate to fetch table data filtering it's details? I want to transform this SQL query with Hibernate Criterion:

select ud.*
  from table1 ud
 where ...

2. HQL: left join fetch with filter?    forum.hibernate.org

I recently started using hibernate to manage the queries in my webapplication, and encountered a problem for that I've found some forum posts but no satisfying answer. I often have to fetch joined information from various tables, wherefore I'd like to use a Query element: Code: Query query = this.getSession().createQuery ("select distinct fipo from Fipo ...

3. how to include left join fetch in a filter?    forum.hibernate.org

Anthony, Thanks for the try, but it didn't work either. I've already tried it in many different ways, but if you have any other ideas, I'll be glad to try them too. Here is the stack trace: net.sf.hibernate.QueryException: unexpected token: left [select this from this left join fetch this.rooms] at net.sf.hibernate.hql.FromParser.token(FromParser.java:77) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138) ...

4. how to make a left join fetch query that filter collection    forum.hibernate.org

Can somebody teach me an approach to left join fetch and filter the collection being fetched. In my situation, I have 4 Hibernate mapped Java classes, and there is a one-to-many relation that goes down through all of them in a line. Each class is a collection of another class. What I want to achieve is that when a collection is ...

5. how to make a left join fetch query that filter collection    forum.hibernate.org

Can somebody teach me an approach to left join fetch and filter the collection being fetched. In my situation, I have 4 Hibernate mapped Java classes, and there is a one-to-many relation that goes down through all of them in a line. Each class is a collection of another class. What I want to achieve is that when a collection is ...

6. how to left join fetch and filter a collection?    forum.hibernate.org

Can somebody teach me an approach to left join fetch and filter the collection being fetched. In my situation, I have 4 Hibernate mapped Java classes, and there is a one-to-many relation that goes down through all of them in a line. Each class is a collection of another class. What I want to achieve is that when a collection is ...

7. One-To-One Filter Applied, Non-Lazy Fetch Problem    forum.hibernate.org

Suppose i have one-to-one association between Product and ProductBasic. and we have applied filter on ProductBasic Class. I have applied this filter as in Java side we have one-to-one relationship between Product and ProductBasic BUT at database side we have one-to-many relationship between PRODUCT and PRODUCTBASIC. and we apply a condition (STARTTIME < CURRETTIME < ENDTIME) while fetching PRODUCTBASIC, and this ...