views:

21

answers:

0

Could you tell me is possible to search by hibernate criteria on bidirectional direction with only unidirectional associations? For examle: I have two class:


Box {   
  Long id;  
  Set parcels;  
  Integer status;    
  // other properites  
}

Parcel {  
  Long id;  
  // other properties  
}

I've got associations one-to-many in class Box to class Parcel and I search Boxes with parameters from Parcel and very often use parcels in Box, so I use eager loading.

But one time I need (to complicated criteria) many-to-one associations Box class in Parcel class (I have to search Parcel by status in box), but only in search, every other cases I don't need pointer to Box when I get Parcel from database.

Can I search in that situations without many-to-one associations in Parcel to Box?