• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbCreate return type should be Primary Key

 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

My question, what the container is doing on the return object(Primary Key) of ejbCreate method.

Spec also says that CMP ejbCreate method return null, if this bean class is in futcure superclass of BMP.

Can u clear me?

Regards
Kasimurugan R.
 
Miki Muzsi
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To my understanding the ejbCreate must always return null, but the Container is using the retrun type of it. It might be that it is overriden?

Miki
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For CMP beans, the Container is not interested in what you return as it is managing the persistence. So, the EJB spec helps everyone out by specifying that null must be returned. What happens behind the scenes is that the Container then uses what you've specified as your primary key field or, with a compound key, the CMP fields that together make up the primary key.
 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger

Yes, i agree with your point. But My question is

Spec says that CMP ejbCreate method return null, if this bean class is in future it can be subclassed for BMP. (See the SPEc pgno 171. point 14).


Thanks & Regards
Kasimurugan R.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic