urlaccountdao.java

来自「hibernate应用测试,初学hibernate 的会员可以看看.」· Java 代码 · 共 76 行

JAVA
76
字号
package com.dao;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import com.ibatis.common.resources.Resources;

import java.io.Reader;
import java.io.IOException;
import java.util.List;
import java.sql.SQLException;

import com.tool.pagetool.*;
import com.bean.*;
public class UrlAccountDAO extends PageDAO{
    public static List selectAllUrlAccount() throws SQLException {
        return sqlMapper.queryForList("selectAllUrlAccount");
   }

   public static List selectRoleByAccountId(int accountId)throws SQLException{
       return sqlMapper.queryForList("selectRoleByAccountId",new Integer(accountId));
   }

   public static UrlAccount selectUrlAccountByurlAccountId(int id) throws SQLException {
       return (UrlAccount) sqlMapper.queryForObject("selectUrlAccountByurlAccountId",       new Integer(id));
   }

   public static void insertUrlAccount(UrlAccount urlaccount) throws SQLException {
      sqlMapper.insert("insertUrlAccount", urlaccount);
   }

   public static void updateUrlAccount(UrlAccount urlaccount) throws SQLException {
       sqlMapper.update("updateUrlAccount", urlaccount);
   }

   public static void deleteUrlAccountByurlAccountId(int id) throws SQLException {
        sqlMapper.delete("deleteUrlAccountByurlAccountId", new Integer(id));
    }

   public int selectCount(Page page) throws SQLException{
        return ((Integer)sqlMapper.queryForObject("selectUrlAccountCount",page)).intValue();
    }

   public int selectCount() throws SQLException{
        return ((Integer)sqlMapper.queryForObject("selectUrlAccountCountNotP")).intValue();
    }

   public List selectForPage(Page page) throws SQLException{
        List pageList = sqlMapper.queryForList("selectUrlAccountForPage",page);
        return pageList;
    }

   public static void startTransation()throws SQLException{
        sqlMapper.startTransaction();
    }

     public static void startTransation(int i)throws SQLException{
        sqlMapper.startTransaction(i);
     }

   public static void rollback() throws SQLException{
        sqlMapper.endTransaction();
     }

   public static void commit()throws SQLException{
        sqlMapper.commitTransaction();
    }

  public static int getLastId() throws SQLException{
       Object obj = sqlMapper.queryForObject("selectUrlAccountLastId");
       if(obj==null) return 0;
       else
       return ((Integer)obj).intValue();
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?