I'm using Spring with hibernate.
The object I'd like to fetch is of class A, which has attribute - a set of object of class B, like
public class A {
private Integer aID;
private Set<B> bs;
private String fieldA1;
private String fieldA2;
// setters and getters
}
public class B {
private Integer bID;
private String fieldB1;
private String fieldB2;
// setters and getters
}
In the mapping file, within the class A mapping tag, I include,
<set name="bs" table="TABLE_B">
<key column="A_ID" />
<one-to-many class="com.proj.test.B"/>
</set>
Now I want to fetch the A object with the bs inside filtered with criteria that depends on value of fieldB1 and fieldB2. (not to fetch all B objects)
Any suggestions / answers?