<!-- ========= START OF TOP NAVBAR ======= -->
<!-- -->
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
javax.ejb
Interface EntityBean
All Superinterfaces:
EnterpriseBean, Serializable
public interface EntityBean
extends EnterpriseBean
The EntityBean interface is implemented by every entity enterprise Bean class. The container uses the EntityBean methods to notify the enterprise Bean instances of the instance's life cycle events. 每一个实体企业Bean的类都应该实现EntityBean接口。容器使用EntityBean的方法 将实例的生命周期事件通知企业Bean。
<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><!-- -->
Method Summary |
void |
ejbActivate() A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object. 容器调用该方法,使实例由可用实例池中移出,与指定EJB对象关联。
|
void |
ejbLoad() A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database. 容器调用该方法,指示实例通过从底层数据库加载来同步其状态。
|
void |
ejbPassivate() A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object. 容器调用该方法,使实例与指定EJB对象解除关联。
|
void |
ejbRemove() A container invokes this method before it removes the EJB object that is currently associated with the instance. 容器调用该方法来删除当前与实例关联的EJB对象。
|
void |
ejbStore() A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database. 容器调用该方法,指示实例通过保存至底层数据库来同步其状态。
|
void |
setEntityContext(EntityContextctx) Set the associated entity context. 设置关联实体bean上下文。
|
void |
unsetEntityContext() Unset the associated entity context. 撤销关联实体bean上下文。
|
<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><!-- -->
<!-- -->setEntityContext
public void setEntityContext(EntityContextctx)
throws EJBException,
RemoteException
Set the associated entity context. The container invokes this method on an instance after the instance has been created. 设置关联实体bean上下文。容器在实例创建后调用该方法。 This method is called in an unspecified transaction context. 方法不在指定事务上下文中调用。
Parameters:
ctx
- An EntityContext interface for the instance. The instance should store the reference to the context in an instance variable. 实例的EntityContext接口。实例应当在实例变量中保存上下文对象的引用。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->unsetEntityContext
public void unsetEntityContext()
throws EJBException,
RemoteException
Unset the associated entity context. The container calls this method before removing the instance. 撤销关联实体bean上下文。容器调用该方法删除实例。 This is the last method that the container invokes on the instance. The Java garbage collector will eventually invoke the finalize() method on the instance. 这是容器针对实例调用的最终方法。Java垃圾收集器最终将调用实例的finalize()方法。
This method is called in an unspecified transaction context. 方法不在指定事务上下文中调用。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->ejbRemove
public void ejbRemove()
throws RemoveException,
EJBException,
RemoteException
A container invokes this method before it removes the EJB object that is currently associated with the instance. This method is invoked when a client invokes a remove operation on the enterprise Bean's home interface or the EJB object's remote interface. This method transitions the instance from the ready state to the pool of available instances. 容器调用该方法来删除当前与实例关联的EJB对象。当客户端基于企业Bean的home接口或者EJB对象的远程接口 调用删除操作时调用该方法,实例将从准备状态转移至可用实例池中。 This method is called in the transaction context of the remove operation. 方法在删除操作的事务上下文中调用。
Throws:
RemoveException
- The enterprise Bean does not allow destruction of the object. 企业Bean不允许清除该对象。
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->ejbActivate
public void ejbActivate()
throws EJBException,
RemoteException
A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object. This method transitions the instance to the ready state. 容器调用该方法,使实例由可用实例池中移出,与指定EJB对象关联,实例变为准备状态。 This method executes in an unspecified transaction context. 方法不在指定事务上下文中执行。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->ejbPassivate
public void ejbPassivate()
throws EJBException,
RemoteException
A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object. After this method completes, the container will place the instance into the pool of available instances. 容器调用该方法,使实例与指定EJB对象解除关联。方法完成后,容器将实例放置于可用实例池中。 This method executes in an unspecified transaction context. 方法不在指定事务上下文中执行。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->ejbLoad
public void ejbLoad()
throws EJBException,
RemoteException
A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database. 容器调用该方法,指示实例通过从底层数据库加载来同步其状态。 This method always executes in the transaction context determined by the value of the transaction attribute in the deployment descriptor. 方法总是在事务上下文中执行,事务上下文决定于部署描述符中的事务属性值。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- -->ejbStore
public void ejbStore()
throws EJBException,
RemoteException
A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database. 容器调用该方法,指示实例通过保存至底层数据库来同步其状态。 This method always executes in the transaction context determined by the value of the transaction attribute in the deployment descriptor. 方法总是在事务上下文中执行,事务上下文决定于部署描述符中的事务属性值。
Throws:
EJBException
- Thrown by the method to indicate a failure caused by a system-level error. 方法抛出该异常表示一个由系统级错误引起的失败。
RemoteException
- This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception. 方法签名中定义该异常是为了对符合EJB 1.0规范的企业bean提供向下兼容。 符合EJB 1.1规范的企业bean应该抛出javax.ejb.EJBException来代替该异常。 符合EJB 2.0或更高版本规范的企业bean也应该抛出javax.ejb.EJBException 来代替该异常。
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<!-- -->
<!-- ======== END OF BOTTOM NAVBAR ======= -->
Submit a bug or feature Copyright 2003 Sun Microsystems, Inc. All rights reserved.
分享到:
相关推荐
javax.ejb.EntityBean.class javax.ejb.EntityContext.class javax.ejb.FinderException.class javax.ejb.Handle.class javax.ejb.HomeHandle.class javax.ejb.IllegalLoopbackException.class javax.ejb.Init.class...
javax.ejb.EntityBean.class javax.ejb.EntityContext.class javax.ejb.FinderException.class javax.ejb.Handle.class javax.ejb.HomeHandle.class javax.ejb.IllegalLoopbackException.class javax.ejb.Init.class...
javax.ejb.EntityBean.class javax.ejb.EntityContext.class javax.ejb.FinderException.class javax.ejb.Handle.class javax.ejb.HomeHandle.class javax.ejb.IllegalLoopbackException.class javax.ejb.Init.class...
javax.ejb.EntityBean.class javax.ejb.EntityContext.class javax.ejb.FinderException.class javax.ejb.Handle.class javax.ejb.HomeHandle.class javax.ejb.MessageDrivenBean.class javax.ejb....
- `javax.ejb.EJB`、`javax.ejb.Local`和`javax.ejb.Remote`等注解:用于标记bean的接口,指定其作用范围和远程访问方式。 - `javax.ejb.TimerService`:提供了定时任务的管理,可以在EJB中创建和管理定时器。 描述...
EJB组件可以分为几种类型,如会话Bean(Session Beans)、实体Bean(Entity Beans)和消息驱动Bean(Message-Driven Beans),每种都有特定的角色和功能。 【子文件】"jsr94-j2ee.rar" 可能包含JSR 94(JavaTM ...
4. **实体Bean(Entity Beans)**:用于持久化数据,通常与数据库中的记录相对应。EJB 3.1引入了注解驱动的JPA(Java Persistence API),简化了实体管理,使得开发者可以直接在类上使用注解来定义实体关系。 5. **...
这些EJB组件可以是会话bean(Session Beans)、实体bean(Entity Beans)或者消息驱动bean(Message-Driven Beans)。会话bean代表了一个短暂的业务逻辑组件,负责处理客户端请求;实体bean则对应于数据库中的持久化...
EJB 3实体Bean通常继承自`javax.ejb.EntityBean`接口或者使用注解(如`@Entity`)来标识。这些Bean代表数据库表的持久化对象,并且可以通过JPA进行ORM操作。 3. **src/main/resources**: 这里可能包含数据库连接...
import javax.ejb.EntityBean; import javax.sql.DataSource; import javax.naming.InitialContext; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; @EntityBean ...
- Entity Bean需实现`javax.ejb.EntityBean`接口。 2. **EJB接口**:包括远程接口(Remote Interface)和本地接口(Local Interface)。远程接口用于跨网络的调用,本地接口则用于同服务器内的调用。 - 远程接口...
包括会话bean(Session Beans)、消息驱动bean(Message-Driven Beans)和实体bean(Entity Beans)。 5. **JSF(JavaServer Faces)**:JSF是一种MVC(模型-视图-控制器)框架,用于构建Web用户界面。`javax.faces...
`javax.ejb`包提供了EJB的接口和类,如`javax.ejb.EJB`注解和`javax.ejb.SessionBean`接口。 4. **JMS(Java Message Service)**:JMS是Java平台上的消息中间件API,允许应用程序发送和接收异步消息。`javax.jms`...
- **javax.ejb包**:包含了EJB技术的基本类和接口,如`javax.ejb.SessionBean`、`javax.ejb.EntityBean`等。 - **javax.ejb.spi包**:提供了SPI(Service Provider Interface)类和接口,用于扩展EJB容器的功能。 ...
`javax.ejb`包定义了各种EJB接口,如Session Beans (`javax.ejb.SessionBean`) 和Message Driven Beans (`javax.ejb.MessageDrivenBean`)。 5. **JPA(Java Persistence API)**:JPA是用于对象关系映射的规范,它...
import javax.ejb.SessionBean; import javax.ejb.SessionContext; public class hello implements SessionBean { private SessionContext context; public hello() {} public void ejbActivate() throws ...
这个"简单EJB3例子"将展示如何使用EJB3来创建一个简单的实体Bean(Entity Bean),这是EJB中负责持久化数据的部分。 首先,了解EJB3中的核心概念: 1. **实体Bean(Entity Bean)**:代表业务对象,通常与数据库中...
EJB API的主要包包括`javax.ejb`,其中包含如`javax.ejb.SessionBean`、`javax.ejb.MessageDrivenBean`和`javax.persistence.Entity`等接口和注解。 这些API不仅提供了丰富的功能,还遵循MVC(Model-View-...
对应的接口如 `javax.ejb.SessionBean`、`javax.ejb.EntityBean` 和 `javax.ejb.MessageDrivenBean`。 - **JMS(Java Message Service)**:JMS接口用于实现消息传递,`javax.jms.MessageProducer` 和 `javax.jms....
3. **开发实体Bean**:实体Bean需要实现特定的接口,如`javax.ejb.EntityBean`或使用注解`@Entity`(在Java EE 5及以后版本)。这些Bean通常使用JPA(Java Persistence API)进行持久化操作,通过ORM(对象关系映射...