Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

ejbCreate method return value...

 
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 ]
 
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.
 
Slideshow boring ... losing consciousness ... just gonna take a quick nap on this tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic