• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Overloading of create methods for stateful session bean home interface

Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Hope that thread might help you...
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic