一个Bean管理(BMP)的实体BEAN编译的问题,关于BEAN返回值类型的问题,请求您的帮助,谢谢!
package mytest;
import javax.ejb.EJBLocalHome;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.util.Collection;
public interface AccountHome
extends EJBLocalHome {
public Account create(String accountID, String ownerName) throws
CreateException;
public Account findByPrimaryKey(AccountPK key) throws FinderException;
^^^^^^^
public Collection findByOwnerName(String name) throws FinderException;
public double getTotalBankValue() throws AccountException;
}
这里的public Account findByPrimaryKey(AccountPK key) throws FinderException;
返回值类型不能为Account么?Account是EJBLocalObject对象,错误信息为:
(开发环境:JBuilder X)
=====================================================================
"EJBModule1.jar": [J2EE:160121]Errors encountered while compiling module 'D:\Documents and Settings\Administrator\jbproject\mystruts\EJBModule1.jar.jar':
"EJBModule1.jar": In EJB Account, the home interface findByPrimaryKey method parameter must be the primary key type or java.lang.Object: findByPrimaryKey(mytest.AccountPK)
"EJBModule1.jar": In EJB Account, the finder ejbFindByPrimaryKey(mytest.AccountPK) returned an unexpected type. Finders in the bean class must return the primary key type, java.util.Collection, or java.util.Enumeration
=====================================================================
请大家指教,谢谢!!
import javax.ejb.EJBLocalHome;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.util.Collection;
public interface AccountHome
extends EJBLocalHome {
public Account create(String accountID, String ownerName) throws
CreateException;
public Account findByPrimaryKey(AccountPK key) throws FinderException;
^^^^^^^
public Collection findByOwnerName(String name) throws FinderException;
public double getTotalBankValue() throws AccountException;
}
这里的public Account findByPrimaryKey(AccountPK key) throws FinderException;
返回值类型不能为Account么?Account是EJBLocalObject对象,错误信息为:
(开发环境:JBuilder X)
=====================================================================
"EJBModule1.jar": [J2EE:160121]Errors encountered while compiling module 'D:\Documents and Settings\Administrator\jbproject\mystruts\EJBModule1.jar.jar':
"EJBModule1.jar": In EJB Account, the home interface findByPrimaryKey method parameter must be the primary key type or java.lang.Object: findByPrimaryKey(mytest.AccountPK)
"EJBModule1.jar": In EJB Account, the finder ejbFindByPrimaryKey(mytest.AccountPK) returned an unexpected type. Finders in the bean class must return the primary key type, java.util.Collection, or java.util.Enumeration
=====================================================================
请大家指教,谢谢!!
...全文
相关推荐
Bean开发实例之三实体Bean开发实例
- **Bean类定义**:对于CMP类型的实体Bean,Bean类是一个实现了`EntityBean`接口的抽象类。
EJB实体Bean与事物管理
实体Bean有两种类型:Bean管理持久性(BMP)和容器管理持久性(CMP)。
EJB实体Bean学习
在这个“EJB实体Bean学习”主题中,我们将深入探讨实体Bean的两大类型——BMP(Business Managed Persistence)和CMP(Container Managed Persistence
EJB 3.0学习之实体Bean
在`@Entity`注解中,`name`属性用于设置Bean的名称,默认与类名相同;`entityType`定义Bean的管理类型,可选CMP(容器管理的持久化)和BMP(Bean管理的持久化);`access
Ejb开发实体bean
**事务管理**:由于涉及数据库操作,EJB容器会自动为实体Bean操作管理事务。例如,添加商品到购物车的操作可能需要在一个事务中完成,确保数据的一致性。9.


