File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes CMP ejbCreate(String) returns what? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP ejbCreate(String) returns what?" Watch "CMP ejbCreate(String) returns what?" New topic
Author

CMP ejbCreate(String) returns what?

Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

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

Joined: Oct 05, 2001
Posts: 1170

I found the answer
CMP returns a null PK
BMP returns a true PK
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CMP ejbCreate(String) returns what?