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.SequenceValueRange; import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Property; import org.springframework.stereotype.Repository; /** * * @author bezdatiuzer */ @Repository("sequenceValueRangeDao") public class SequenceValueRangeDao extends Dao<SequenceValueRange> { @Override public Class getSupportedClass() { return SequenceValueRange.class; } public List<SequenceValueRange> findBySeqUid(SequenceValueRange svr) { Criteria cr = currentSession().createCriteria(getSupportedClass()); cr.add(Property.forName("uid").eq(svr.getUid())); cr.add(Property.forName("sequence").eq(svr.getSequence())); cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return cr.list(); } }