tags:

views:

63

answers:

0

Ok, Class A can have many Class B. Class B can have many Class A

Class A {

@ManyToMany(
        mappedBy="as",
        targetEntity=B.class,
        fetch=FetchType.LAZY
    )
List bs;
}

Class B {

@ManyToMany(
        mappedBy="bs",
        targetEntity=A.class,
        fetch=FetchType.LAZY
    )
List as;
}

now I want to select some A classes that have a set of B classes in their list of B classes. I.e. "give me all A that have the B's with b.id=3, b.id=4, b.id=5 (all of them, not just one or two)" I would like to do this is criteria form.

Could somebody help??

Thanks!