• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejbCreate method return value...

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic