Java通用DAO类:yagdao
jopen
12年前
yagdao 是一个通用DAO(Data Access Objects)类,支持JPA2和hibernate,用户不用编写代码就能够实现一些常用的CRUD操作和查询操作。
public interface SimpleBeanDAO extends GenericDAO<SimpleBean, Long> { /** * Sample save method with two properties */ @YMethod(type = YMethodType.SAVE) SimpleBean customSave1(@YParameter("pstring") String p1, @YParameter("pdouble") double p2); @YMethod(type = YMethodType.UPDATE) SimpleBean customUpdate1(long id, @YParameter("pstring") String p1, @YParameter("pdouble") double p2); @YMethod(type = YMethodType.QUERY, query = "select s from SimpleBean s where s.pint>:minint") List<SimpleBean> customQuery2(@YParameter("minint") int arg1); @YMethod(type = YMethodType.CRITERIA) SearchResultList<SimpleBean> criteria1(@YParameter(value = "pint", operator = YOperator.GE) Integer arg1, YPage page); @YMethod(type = YMethodType.COUNT) long count1(@YParameter(value = "pint", operator = YOperator.GE) Integer arg1); }