A home interface defines one or more create<METHOD>(...) methods, one for each way to create a session object. Is each create need unique name, do not allow overload? such as create(String id), create(String id, int i)).
Hey Bin: I'm pretty sure that you can overload create method as long as the parameter lists are different. Just make sure that for each create<method> method in your home you have a corresponding ejbCreate<method> in your bean class. Hope this helps.
Hi Bin, Welcome to JavaRanch and this forum ! I agree with what Keith wrote above, as far as we talk about *stateful* session beans and/or entity beans, meaning that such an overloading is N/A to stateless session beans. Best, Phil.
Howdy -- Keith and Phillipe are correct: you can overload create methods ONLY for stateful session beans and entity beans. Also, you can make different create *names* by appending something after the "create" part of the method name, like createBigAccount(), createFoo(), etc. But you don't have to. You're free to overload create methods as long as you follow Java standard rules for method overloading (i.e. must vary the argument list) and you do as Keith said, match each create with ejbCreate() in the bean (and for an entity, ejbPostCreate() as well). 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 cheers, Kathy