The method name must have ejbCreate as its prefix. The method must be declared as public. The method must not be declared as final or static. The return type must be the entity bean�s primary key type
ejbCreate() must return primarykey. primarykey can be either be class or it can be object type(like String,Integer etc) But it cannot be primitive(like int) Now public int ejbCreate() throws javax.ejb.CreateException. returns int which i think is Wrong.
gowher is right, the primary key field cannot be primitive
it has to be a subclass of java.lang.Object. It need not be String or wrapper classes like Integer,Long.. you can define your own class as a primary key.