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

📄 insertemployeecommand.java

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

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

/**
 * InsertEmployeeCommand, this class
 * is the usecase specific Command bean that
 * an application developer would write.
 */
public class InsertEmployeeCommand extends BaseUpdateCommand
{

    static String statement = "insert into Employees (EMPLOYEEID, NAME, EMAIL) values (?,?,?)";
    static final String dataSourceJNDI = "bookPool";
    /**
     * Passes parent class the usecase specific sql statement to use
     */
    protected InsertEmployeeCommand() throws DataCommandException
    {

        super(dataSourceJNDI, statement);
    }

    public void setEmail(String anEmail) throws DataCommandException
    {
        try
        {
            pstmt.setString(3, anEmail);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }

    public void setId(int id) throws DataCommandException
    {
        try
        {
            pstmt.setInt(1, id);
        } catch (SQLException e)
        {
            throw new DataCommandException(e.getMessage());
        }
    }

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

    }
}

⌨️ 快捷键说明

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