• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbCreate method return value...

 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have read that the ejbCreate method of an entity bean's return type must be the type of the primary key of the bean. In many examples I have seen a return value of null.

Why is this exactly. If we return null, how does the container know what is the primary key of the bean?

example:

public Integer ejbCreate(String name, String location) {
this.setName(name);
this.setLocation(location);

// Return null..!!! huh??
return null;
}

Apparently it is correct to return a null from ejbCreate..!

Little bit lost as to why this could be. Thanx for your help.

James.
[ October 19, 2004: Message edited by: James Turner ]
 
sanjeevmehra mehra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DD contains information about the primary key. while writing DD you need to mention the information about primary key. Container gets info about PK from there.

thanks & regards,
Sanjeev.
 
James Turner
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the reply...

I assume the return null is to do with backward compatibility with EJB1.1 when primary key info was not in the DD is that true?

I think it is something to do with EJB 1.1

Thanx for your reply.

James.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic