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

📄 sqlmaplinkdao.java

📁 java写的blog
💻 JAVA
字号:
/*
 * Created on 2004-10-4
 * Author: Xuefeng, Copyright (C) 2004, Xuefeng.
 */
package org.crystalblog.dao.ibatis;

import java.sql.SQLException;
import java.util.List;

import org.crystalblog.dao.LinkDao;
import org.crystalblog.domain.Link;
import org.crystalblog.exception.*;

import com.ibatis.sqlmap.client.SqlMapClient;

/**
 * TODO Description here...
 * 
 * @author Xuefeng
 */
public class SqlMapLinkDao implements LinkDao {

    private SqlMapClient sqlMap = SqlConfig.getSqlMapInstance();

    public List getAllLinks(int accountId) throws QueryException {
        try {
            return sqlMap.queryForList("getAllLinks", new Integer(accountId));
        }
        catch(SQLException sqle) {
            throw new QueryException(sqle);
        }
    }

    public Link getLink(int linkId) throws QueryException {
        try {
            return (Link)sqlMap.queryForObject("getLink", new Integer(linkId));
        }
        catch(SQLException sqle) {
            throw new QueryException(sqle);
        }
    }

    public int getLinksCount(int categoryId) throws QueryException {
        try {
            return ((Integer)sqlMap.queryForObject("getLinksCount", new Integer(categoryId))).intValue();
        }
        catch(SQLException sqle) {
            throw new QueryException(sqle);
        }
    }

    public void createLink(Link link) throws CreateException {
        try {
            sqlMap.insert("createLink", link);
        }
        catch(SQLException sqle) {
            throw new CreateException(sqle);
        }
    }

    public void updateLink(Link link) throws UpdateException {
        try {
            sqlMap.update("updateLink", link);
        }
        catch(SQLException sqle) {
            throw new UpdateException(sqle);
        }
    }

    public void deleteLink(int linkId) throws DeleteException {
        try {
            sqlMap.delete("deleteLink", new Integer(linkId));
        }
        catch(SQLException sqle) {
            throw new DeleteException(sqle);
        }
    }

}

⌨️ 快捷键说明

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