Hi,
I'm trying to add several restrictions to a disjunction while using two aliases. Is this possible?
My Breakdown class is associated to a Elevator and GhostElevator classes and I'd need to check conditions on both these associations.
While
Code:
DetachedCriteria criteria = DetachedCriteria.forClass(Breakdown.class)
.createAlias("ghostElevator", "ghost")
.add(Restrictions.disjunction()
.add(Restrictions.in("ghost.suggestedSociety.id", societies)));
with criteria created:
Quote:
DetachableCriteria(CriteriaImpl(it.linksystem.csai.model.Breakdown:this[Subcriteria(ghostElevator:ghost)][(ghost.suggestedSociety.id in (26, 4))]))
while this and the other criteria work separately if I do a disjunction on both:
Code:
DetachedCriteria criteria = DetachedCriteria.forClass(Breakdown.class)
.createAlias("elevator", "el")
.createAlias("ghostElevator", "ghost")
.add(Restrictions.disjunction()
.add(Restrictions.in("ghost.suggestedSociety.id", societies))
.add(Restrictions.in("el.society.id", societies)));
I don't get any results back, even though the criteria seems reasonable:
Quote:
DetachableCriteria(CriteriaImpl(it.linksystem.csai.model.Breakdown:this[Subcriteria(elevator:el), Subcriteria(ghostElevator:ghost)][(ghost.suggestedSociety.id in (26, 4) or el.society.id in (26, 4))]))
Is having more than one alias not supported with the Criteria API or am I creating the criteria in a wrong way?
Hibernate version: 3.2.6
Full stack trace of any exception that occurs:
Name and version of the database you are using:Postgresql 8.3