I am new to
EJB.
I created a very simple CMP entity bean and tried to build the EJB by the deploy tool.
Here is the code:
1. Remote interface package demo.xy.commands;
import java.rmi.*;
import javax.ejb.*;
/**
* Remote interface defines the business functions
* of this entity bean.
*/
public interface CommandsRemote extends EJBObject {
//Primary key
public Integer getId() throws RemoteException;
public void setId(Integer Id) throws RemoteException;
public
String getName() throws RemoteException;
public void setName(String name) throws RemoteException;
}
2. Home interface package demo.xy.commands;
import java.rmi.*;
import javax.ejb.*;
public interface CommandsHome extends EJBHome {
public CommandsRemote create(Integer id) throws CreateException, RemoteException;
public CommandsRemote findByPrimaryKey(Integer pk) throws FinderException, RemoteException;
}
3. Bean class package demo.xy.commands;
import javax.ejb.*;
public abstract class CommandsBean implements EntityBean {
public Integer ejbCreate(Integer id) {
this.setId(id);
return null;
}
public void ejbPostCreate(Integer id) {
}
public abstract Integer getId();
public abstract void setId(Integer id);
public abstract String getName();
public abstract void setName(String name);
public void setEntityContext(EntityContext ctx) {
}
public void unsetEntityContext() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbLoad() {
}
public void ejbStore() {
}
public void ejbRemove() {
}
}
The following is the result I got by verifying my JAR using the "verify" function in the deploytool.
-------------------------------
FAILED
TEST - EJB tests
-------------------------------
***********************************************************
Test Name: tests.ejb.entity.cmp2.CmpFieldAccessorModifiers
Test Assertion: EJB 2.0 Spec 9.4.1, cmp field accessors methods must be abstract, public or protected
Detailed Messages:
Error : [ set ] accessor method for field [ decription ] is not abstract and public or protected
***********************************************************
***********************************************************
Test Name: tests.ejb.entity.cmp2.CmpFieldsAccessorExposition
Test Assertion: EJB 2.0 Spec 9.4.11 Set Accessor method for primary key fields should not be exposed in the remote interface
Detailed Messages:
Error : Primary key field set accessor method [ roleId ] is exposed through the remote interface [ RoleRemote ]
***********************************************************
***********************************************************
Test Name: tests.ejb.entity.cmp2.CmpFieldAccessor
Test Assertion: EJB 2.0 Spec 9.4.1, cmp field accessors must bear the name of the field, first letter uppercased and prefixed with get and set
Detailed Messages:
Unexpected error in verifier, check for problems related to: [ java.lang.IllegalArgumentException: argument number too large at ]
***********************************************************
Can anybody tell me what is worng in my code?
Thanks in advance.