Hi there, I would just like the official word on this matter, can create methods in stateful session beans/entity beans home interface be overloaded like this? create(String name) throws ... create(int studentId) throws... or can the home interface just contain this: createStudent(String name) throws... without any default create() or create(args) in the home interface? or must there be at least one create() or create(args)? Please bear in mind that I am refering to stateful session beans and entity beans here. Thanks!!
Stateful session beans must have at least one create method. Its not mandatory to have a create() method which does not take any arguments. Each create method must be named �create<METHOD>�, and it must match one of the ejbCreate<METHOD> methods defined in the session bean class. For entity beans, its optional to have create methods. The container invokes an ejbCreate<METHOD>(...) method on an entity bean instance when a client invokes a matching create<METHOD>(...) method on the entity bean�s home interface. Thanks
Hi steward, There was a discussion in the past in this forum... Here is the link. Kathy said
FYI -- someone has brought it to my attention that there is a bug in the RI that causes the verifier to complain if you do NOT have a create defined for an entity bean. So please remember that the exam is based on the specification, and where the RI differs from the spec, you MUST follow the spec. So it's perfectly valid in the spec to define an entity bean with NO create() method, but the RI verifier will complain. That's just an RI bug. Oh, and the RI also forces you (you've probably discovered this) to define a CreateException on create methods in your bean class. It is always considered good practice, but not required in the spec. But the RI will FORCE you to declare it in your bean. Just be aware of those little *fun* issues