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.ValueRange; import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Property; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; /** * * @author bezdatiuzer */ @Repository("valueRangeDao") public class ValueRangeDao extends Dao<ValueRange> { @Override public Class getSupportedClass() { return ValueRange.class; } public List<ValueRange> findBySceneUid(ValueRange vr) { Criteria cr = currentSession().createCriteria(getSupportedClass()); cr.add(Restrictions.eq("uid", vr.getUid())); cr.add(Restrictions.eq("scene", vr.getScene())); //cr.add(Property.forName("uid").eq(vr.getUid())); //cr.add(Property.forName("scene").eq(vr.getScene())); cr.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return cr.list(); } }