Return to Snippet

Revision: 50414
at August 20, 2011 00:43 by skurt


Initial Code
import com.lempa7.demandlempa.*
import com.lempa7.demandlempa.enums.*
import org.hibernate.Session
import org.hibernate.SessionFactory
import org.hibernate.criterion.*

SessionFactory sessionFactory = ctx.sessionFactory
def session = sessionFactory.getCurrentSession()
def criteria = session.createCriteria(TextOrder.class)
//.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY)
.setFirstResult(0).setMaxResults(5)
.add( Restrictions.eq("status", TextOrderStatus.UNASSIGNED) )
criteria.list()

Initial URL

                                

Initial Description
see also http://floledermann.blogspot.com/2007/10/solving-hibernate-criterias-distinct.html

Initial Title
Hibernate criteria via session in grails

Initial Tags

                                

Initial Language
Groovy