Hibernate - Conditions are not applied in Inner Criteria Query
posted 7 years ago
Criteria restrictions are not applied in the items of the collections. I have a persistence entity (POJO) Menugroup and it has a collection called catgroups (HashSet, one to many). Catgroup persistence entity (POJO) has another one-to-many collection "dealitems" (HashSet). My criteria query is below:
Mapping file snippet of Menugroup.hbm.xml is below:-
When I run my code, hibernate generates the below 2 sqls and they are displayed in the console
Hibernate generated SQL query-1
Hibernate generated SQL query-2:
The issue issue is, in the result, items in the catgroups collections are not in ascending order and the restriction "published=true" are also not applied on them. I meant to say that below condtions from my criteria query are not applied on catgroups collections.
The above critieria conditions should be applied on hibernate generated 2nd SQL query but it does not happen. Could any one help me to find out whether I have missed some thing in my criteria query to get the result as I expected or this is a bug in criteria query. ?
Expected result: Items in the catgroups collection should be in order and the condition "published"=true should applied.
I hope, the information i provided above would help to understand what is the problem I face.