Hi,
i have a problem with define criteria for collection (LIST).
my objectA:
Code:
@OneToMany(mappedBy = "...", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "owner_id")
private List<Load> loads;
object Load:
Code:
@ManyToOne (fetch = FetchType.LAZY)
@JoinColumn(name = "owner_id", referencedColumnName = "id", nullable = false)
private ObjectA objectA;
i need define criteria:
Code:
Criteria dateValidCriteria = session.createCriteria(ObjectA.class);
Disjunction disjunction = Restrictions.disjunction();
.... create disjunction .....
dateValidCriteria.createCriteria("loads").add(disjunction);
but, problem is I have too many rows in result:
the first object A with 3 load objects.
the second object A with 2 load objects.
the third object A with 1 load object.
the result:
first objectA - load1
first objectA - load2
first objectA - load3
first objectA - load1
first objectA - load2
first objectA - load3
first objectA - load1
first objectA - load2
first objectA - load3
second objectA - load1
second objectA - load2
second objectA - load1
second objectA - load2
third objektA - load1
third objektA - load2
why I have not this result:
first objectA - load1
first objectA - load2
first objectA - load3
second objectA - load1
second objectA - load2
third objektA - load1
third objektA - load2
thanks!
Ivan