This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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?
 
Similar Threads
ejbCreate, primary keys and deployment descriptors question
Intresting Question
Error from ejbc on ejbCreate and ejbPostCreate
Entity bean with composite key
How to create Entity Bean without a Primary Key class