Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why need no-arg constructor ?

 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is the sentence book ,can anyone explain?
"Session bean class must make a no-arg constructor avaiable?"
[ April 02, 2002: Message edited by: Win Yu ]
 
Bagwan Mehrat
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to Monson-Haefel, EJB containers create EJB's using Class.newInstance(). As you know, Class.newInstance() requires a no-argument constructor. Users of the Class class know that you can use the Class.getConstructors() calls to get the constructors if you happen to want to call them, but the container wouldn't know which one to use. EJB's are more abstract than classes anyway, and use the ejbCreate() mechanism for initialization and instantiation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic