Joined: Thu Oct 12, 2006 7:39 am Posts: 4
|
SORRY! Wrong forum...please ignore...
Hi
I have this:
public class Parent {
int id;
Set childs;
public void addImMotherOrf(final Child child) {
getChilds().add(child);
child.setMother(this);
}
public void addImFatherOf(final Child child) {
getChilds().add(child);
child.setFather(this);
}
//plus all the setters and getters
}
public class Child {
int id;
Parent mother;
Parent father;
//plus all the setters and getters
}
Now, I like to query the childs of given parents. I do this like that:
...
Child child = new Child();
Parent mother = new Parent();
Parent father = new Parent();
mother.setId(1);
father.setId(2);
mother.addIamMotherOf(child);
father.addIamFatherOf(child);
Criteria crit = session.createCriteria(Child.class);
crit.add(Example.create(child));
List result = crit.list();
...
This results in the following SQL
select .... from child_table where (1=1)
I checked the mapping. I found it quite correct.
Any suggestions?
Stefan
|
|