javax.ejb.EntityBean翻译

博客介绍了javax.ejb包下的EntityBean接口,指出每个实体企业Bean类都应实现该接口,容器会用其方法通知企业Bean实例的生命周期事件,还列举了setEntityContext、ejbRemove等相关方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!-- ========= START OF TOP NAVBAR ======= --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ========= 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 ========== --><!-- -->

Method Detail
<!-- -->

setEntityContext

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

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

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

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

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

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

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 ====== --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ======== END OF BOTTOM NAVBAR ======= --> Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

1. 用户与权限管理模块 角色管理: 学生:查看实验室信息、预约设备、提交耗材申请、参与安全考核 教师:管理课题组预约、审批学生耗材申请、查看本课题组使用记录 管理员:设备全生命周期管理、审核预约、耗材采购与分发、安全检查 用户操作: 登录认证:统一身份认证(对接学号 / 工号系统,模拟实现),支持密码重置 信息管理:学生 / 教师维护个人信息(联系方式、所属院系),管理员管理所有用户 权限控制:不同角色仅可见对应功能(如学生不可删除设备信息) 2. 实验室与设备管理模块 实验室信息管理: 基础信息:实验室编号、名称、位置、容纳人数、开放时间、负责人 功能分类:按学科(计算机实验室 / 电子实验室 / 化学实验室)标记,关联可开展实验类型 状态展示:实时显示当前使用人数、设备运行状态(正常 / 故障) 设备管理: 设备档案:名称、型号、规格、购置日期、单价、生产厂家、存放位置、责任人 全生命周期管理: 入库登记:管理员录入新设备信息,生成唯一资产编号 维护记录:记录维修、校准、保养信息(时间、内容、执行人) 报废处理:登记报废原因、时间,更新设备状态为 "已报废" 设备查询:支持按名称、型号、状态多条件检索,显示设备当前可用情况 3. 预约与使用模块 预约管理: 预约规则:学生可预约未来 7 天内的设备 / 实验室,单次最长 4 小时(可设置) 预约流程:选择实验室→选择设备→选择时间段→提交申请(需填写实验目的) 审核机制:普通实验自动通过,高危实验(如化学实验)需教师审核 使用记录: 签到 / 签退:到达实验室后扫码签到,离开时签退,系统自动记录实际使用时长 使用登记:填写实验内容、设备运行情况(正常 / 异常),异常情况需详细描述 违规管理:迟到 15 分钟自动取消预约,多次违规限制预约权限 4. 耗材与安全管理模块 耗材管理: 耗材档案:名称、规格、数量、存放位置、
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值