技术开发 频道

hibernate自动生成xml,vo,dao

  主要接口

  其中有一个接作接口,

public interface DataStore { /** *//** * 删除单个vo * @param obj 需要设置主键 * @throws com.piliskys.exception.DAOException */ public void delete(Object obj) throws DAOException; /** *//** * 删除一系列vo * @param obj 所有字段可设置null, 若属性为字符串,可设置为 %,自动删除匹配的VO * @return 删除后返回的行数 * @throws DAOException */ public int deleteByVO(Object obj) throws DAOException; /** *//** * 单个vo更新 * @param obj 要设置主键(作为查询条件) 其它set属于更新字段 * @throws DAOException */ public int update(Object obj) throws DAOException; /** *//** * 条件可如是字符串可设置带%,其它可设置null,不能设置为''字符串 * 以前一对像做为条件进行批量更新后一对象设置的值 * @param obj 条件 * @param obj1 要更新的值 * @throws DAOException */ public int update(Object obj,Object obj1) throws DAOException; /** *//** * 插入一VO * @param obj 要设置一些相应的属性 * @return * @throws DAOException 违反插入操作报错 */ public Serializable insert(Object obj) throws DAOException; /** *//** * 返回设置最大个数的vo * @param class1 * @return * @throws DAOException */ public List selectAll(Class class1) throws DAOException; /** *//** * 根据主键查找vo * @param obj 要设置主键 * @return 返回一相应的vo * @throws DAOException */ public Object selectByPK(Object obj) throws DAOException; /** *//** * 根据对象设置的属性的值进行查找 * @param obj 可设置null,字符串字段可设置带%字符串 * @return 对应的list * @throws DAOException */ public List selectByVO(Object obj) throws DAOException; /** *//** * 根据对象设置的属性及起始和结束的个数的值进行查找 * (用于分页) * @param obj * @param i 开始的行 * @param j 结束的行 * @return 对应的list * @throws DAOException */ public List selectByVO(Object obj, int i, int j) throws DAOException; /** *//** * hibernate的事物管理 * @return hibernate事物 */ public Transaction currentTransaction() throws DAOException;; /** *//** * hibernate中直接调用sql语句(用于update和delete) * @param s sql字符串 * @return 更新或删除的个数 * @throws DAOException */ public int sqlExcute(String s) throws DAOException; /** *//** * hibernate中直接调用sql语句(用于update和delete) * @param s 带“?”的字符串 * @param list 参数的设置 * @return 更新或删除的个数 * @throws DAOException */ public int sqlExcute(String s, List list) throws DAOException; /** *//** * 利用sql中带参数的查询 * @param s 带 “?”字符的字符串 * @param list 参数集合 * @return List 含map的list,key为字段全部小写 * @throws DAOException */ public List selectBySQL(String s, List list) throws DAOException; /** *//** * HQL查询 * @param s * @param list 参数对应值系列 * @return * @throws DAOException */ public List selectByQuery(String s, List list) throws DAOException; /** *//** * * @param s HQL * @param list 参数对应值系列 * @param i 结果集开始数 * @param j 结果集数 * @return * @throws DAOException */ public List selectByQuery(String s, List list,int i,int j) throws DAOException; public void flush() throws DAOException; public void close(); public void open();
0
相关文章