Thanks for your response.
It really dont make sense to use the example. I totally agree.
Criteria c = getSession().createCriteria("A");
c.add(Restrictions.like("name","rus%");
subcriteriaOnB = c.createCriteria("B");
subcriteriaOnB.add(Restriction.in(.....
But when i use the above criteria query, i have one more problem,
Assume:
A --> B is 1 --> Many
A ==> 2 values
i.e (pk) ==> 1, 2
B ==> 8 values
i.e (pk) ==> 1,2,3,4,5,6,7,8
i.e (fk) ==> 1,1,1,1, 2,2,2,2
When i put some criteria on B, for example :
Criteria c = getSession().createCriteria("A");
c.add(Restrictions.like("name","rus%");
subcriteriaOnB = c.createCriteria("B");
subcriteriaOnB.add(Restriction.in("B.pk", 1,2,5,6)
c.list()
I get total 4 results (1,1), (1,2), (2,5),(2,6) ::
My problem :: can i get only 2 values i.e of A in the result set
And later an iterate through B's values
Do let me know if its possible. (if so, how???)
(Bascially, i want to get only A's values in resultset (but at the same time applying Filters on B )
|