moviebean.java

来自「Thinking in Java 是学习JAVA的经典教材」· Java 代码 · 共 62 行

JAVA
62
字号
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
package javatheater.ejb.implementation;

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

public abstract class MovieBean implements EntityBean {
    // EJB/Container contracts
    public Integer ejbCreate(Integer id, String title)
            throws CreateException {

        if (id == null)
            throw new CreateException("Primary key cannot be null");
        if (id.intValue() == 0)
            throw new CreateException("Primary key cannot be zero");

        setId(id);
        setTitle(title);

        return null;
    }

    public void ejbPostCreate(Integer id, String title) {
    }

    public void ejbLoad() {
    }

    public void ejbStore() {
    }

    public void ejbRemove() {
    }

    public void ejbActivate() {
    }

    public void ejbPassivate() {
    }

    public void setEntityContext(EntityContext ctx) {
    }

    public void unsetEntityContext() {
    }

    // Accessors/Mutators for persistent fields.

    // Note that the setId() method is not part of the
    // home interface, so that client applications cannot
    // arbitrarily modify the primary key
    public abstract Integer getId();

    public abstract void setId(Integer id);

    public abstract String getTitle();

    public abstract void setTitle(String title);
}

⌨️ 快捷键说明

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