Jayanthisri wrote:
Hi ,
I have a hibernate createCriteria as follows:
Criteria criteria = getSession().createCriteria(OfferCredit.class);
criteria.createCriteria("offer").add(
Restrictions.eq("status", LeverageUtils.ACTIVE_STATUS)).add(
Restrictions.ge("expirationDate", new Date()));
criteria.createCriteria("user").add(Restrictions.eq("userId", userId));
criteria.add(Restrictions.eq("status", LeverageUtils.ACTIVE_STATUS));
criteria.addOrder(Order.asc("creationDate"));
list = criteria.list();
where OfferCredit, Offer and User are tables. I want the OfferCredit if the offer in Offer table is active and the user in User table is active.(OfferCredit table has offer and user but has no reference if they are active.So i need to check with offer and user table)
My OfferCredit.groovy has User and Offer
Please help me with creating criteria(in grails) same as above.