Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package data.dao; import data.dao.parent.Dao; import data.entity.FreeValueRange; import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Property; import org.springframework.stereotype.Repository; /** * * @author bezdatiuzer */ @Repository("freeValueRangeDao") public class FreeValueRangeDao extends Dao<FreeValueRange> { @Override public Class getSupportedClass() { return FreeValueRange.class; } public List<FreeValueRange> findByEventUid(FreeValueRange fvr) { Criteria cr = currentSession().createCriteria(getSupportedClass()); cr.add(Property.forName("uid").eq(fvr.getUid())); cr.add(Property.forName("event").eq(fvr.getEvent())); cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return cr.list(); } }