Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMP ejbCreate(String) returns what?

 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should I return from my CMP bean class? The home interfaces are returning the actual instance, but what does the bean return to the home interface?
I have Mastering EJB in which he returns a primary Key from his bean implementation class. Then at times I have seen null returned. Does the container expect me to return something here, since its not demanding anything and I am getting no compiling errors regardless of what I try.
public void ejbCreate(String name) {
}
or
public MyPK ejbCreate(String name) {
return new MyPK(somevalue);
}
which of these is proper for a CMP Entity bean?
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer
CMP returns a null PK
BMP returns a true PK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic