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

📄 queryemployeebynamecommand.java

📁 100多M的J2EE培训内容
💻 JAVA
字号:
package examples.datacommands;


import java.sql.*;
import javax.sql.*;

/**
 * A usecase specific querying object
 **/
public class QueryEmployeeByNameCommand extends BaseReadCommand
{

    static final String statement = "select EMPLOYEEID, NAME, EMAIL from Employees where NAME = ?";
    static final String dataSourceJNDI = "bookPool";

    protected QueryEmployeeByNameCommand() throws DataCommandException
    {
        super(dataSourceJNDI, statement);
    }

    public String getEmail() throws DataCommandException
    {
        try
        {
            return rowSet.getString(3);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }

    public int getId() throws DataCommandException
    {
        try
        {
            return rowSet.getInt(1);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }

    public String getName() throws DataCommandException
    {
        try
        {
            return rowSet.getString(2);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }

    public void setName(String aName) throws DataCommandException
    {
        try
        {
            pstmt.setString(1, aName);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }
}

⌨️ 快捷键说明

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