sethrohit1977 wrote:
May be I am not able to get your question. If you can explain what you need to do along with relationship between entities, I might be able to help.
I already have a list of dogs, and I would like to find related cats.
DB:
[cat] --+-- [cat_and_dog_relation] --+-- [dog]
in Cat.java
Code:
int catid;
[attributes....]
private Set<Dog> dogs = new HashSet<Dog>(0);
in Dog.java
Code:
int dogid;
[attributes....]
private Set<Cat> cats = new HashSet<Cat>(0);
At first, I query:
Code:
List<Dog> dogs = getDogsGroup(1);
Criteria crit = session.createCriteria(Cat.class);
Criteria dogCrit = crit.createCriteria("dogs");
??????
And how to continue? Thank You Very Much.