tags:

views:

11

answers:

0

Hi,

I am currently writting a piece of code for retrive data using hibernate with the criteria APi.

I have one class-A This class have one property CollectionOfB; This collection collection contain object of another class that is class B.

Class B have one property CollectionOfC; This collection collection contain object of another class that is class C.

My requirement is to to retrive the list of A which contain object of A. Each A object contain list of Object C.

Snippet: return sessionFactory.getCurrentSession().createCriteria(A.class) .createAlias("collectionA","collectionA") .setFetchMode("collectionA", FetchMode.JOIN) .setFetchMode("collectionA.CollectionB",FetchMode.JOIN) .list();

But this code is not working fine.