⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clienttabledao.java

📁 hibernate应用测试,初学hibernate 的会员可以看看.
💻 JAVA
字号:
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 ClientTableDAO extends PageDAO{
    public static List selectAllClientTable() throws SQLException {
        return sqlMapper.queryForList("selectAllClientTable");
   }

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

   public static boolean isHasClient(String whereStr)throws SQLException{
       boolean flag = false;
       Object obj =sqlMapper.queryForObject("selectIsHasClient",whereStr);
       if(obj!=null)flag=true;
       return flag;
   }

   public static boolean isHasReferClient(ClientTable client)throws SQLException{
       boolean flag = false;
       ClientTable tmp = (ClientTable)ClientTableDAO.selectClientTableByclientId(client.getClientId());
       if(tmp.getIsUsed()>0) flag=true;
       return flag;
   }

   public static void insertClientTable(ClientTable clienttable) throws SQLException {
      sqlMapper.insert("insertClientTable", clienttable);
   }

   public static void updateClientTable(ClientTable clienttable) throws SQLException {
       sqlMapper.update("updateClientTable", clienttable);
   }

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

    public static void updateClientTableForD(ClientTable clientTable) throws SQLException{
        sqlMapper.update("updateClientTableForD",clientTable);
    }

    public static void updateClientTableForDiscount(ClientTable clientTable) throws SQLException{
        sqlMapper.update("updateClientTableForDiscount",clientTable);
    }

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

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

   public List selectForPage(Page page) throws SQLException{
        List pageList = sqlMapper.queryForList("selectClientTableForPage",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("selectClientTableLastId");
       if(obj==null) return 0;
       else
       return ((Integer)obj).intValue();
    }

    public static List selectClientTableNaAnID() throws SQLException {
        return sqlMapper.queryForList("selectAllClientTableNaAnID");
   }

}

⌨️ 快捷键说明

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