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

📄 orderejb.java

📁 Junit in Action的随书原代码
💻 JAVA
字号:
package junitbook.ejb.domain;

import java.rmi.RemoteException;
import java.util.Date;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;

public abstract class OrderEJB implements EntityBean
{
    public abstract Integer getOrderId();
    public abstract void setOrderId(Integer orderId);
    public abstract Date getOrderDate();
    public abstract void setOrderDate(Date orderDate);
    public abstract String getOrderItem();
    public abstract void setOrderItem(String item);

    public Integer ejbCreate(Date orderDate, String orderItem)
        throws CreateException
    {
        int uid = 0;

        // Note: Would need a real counter here. This is a hack!
        uid = orderDate.hashCode() + orderItem.hashCode();
        
        setOrderId(new Integer(uid));
        setOrderDate(orderDate);
        setOrderItem(orderItem);
        
        return new Integer(uid);
    }

    public void ejbPostCreate(Date orderDate, String orderItem)
        throws CreateException {}
    public void ejbActivate() 
        throws EJBException, RemoteException {}
    public void ejbLoad() 
        throws EJBException, RemoteException {}
    public void ejbPassivate() 
        throws EJBException, RemoteException {}
    public void ejbRemove() 
        throws RemoveException, EJBException, RemoteException {}
    public void ejbStore() 
        throws EJBException, RemoteException {}
    public void setEntityContext(EntityContext context) 
        throws EJBException, RemoteException {}
    public void unsetEntityContext() 
        throws EJBException, RemoteException {}
}

⌨️ 快捷键说明

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