Size of assosiation in Hibernate criteria.
- by trnl
Hello guys.
I've faced with a problem when querying with Hibernate Criteria in Grails.
Take a look:
def visitors = Client.withCriteria{
visits{
use ( TimeCategory ) {between('date',date,date+1.month-1)}
}
sizeGe("visits",params.from)
sizeLe("visits",params.to)
fetchMode("visits", FM.JOIN)
};
I need only those clients, which has number of visits in month between from and to bounds.
But now size* restrictions is being applied to all visits. So if client has one visit in this month, and visit in previous month. And if I set from=2, this client will be in result. But it should not be there.
Any help is appreciated.
Thanks, Vova.