EJB问题:数据库表中主键是自增1的,实体Bean的Create方法该怎么写?
枫叶会红 2004-07-31 10:01:09 一般容器管理的实体Bean的默认create方法的入口参数是表的主键。如:
public ProductKey ejbCreate(java.lang.Integer product_id)
throws javax.ejb.CreateException {
setProduct_id(product_id);
return null;
}
现在问题是我的主键在数据库表中自增1的,创建bean时会报错说表的主键是自增的。我加了一个不带任何参数的create(同时对应加一个ejbPostCreate)也会报错:
public ProductKey ejbCreate()
throws javax.ejb.CreateException {
return null;
}
请EJB高手指点。