This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

primary key type can't be primitive type. True?

 
warren li
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFEJB book, I saw "public int ejbCreate() throws CreateException" is considered as wrong. So, is it true that primary key type must be java object type, and cannot be primitive type?

Thanks for confirmation.
 
warren li
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the answer to myself. Thanks.
 
NareshAnkuskani Kumar
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi wareen,

if the return type of the 'ejbCreate' method must be java object type. then how to deal with primary key whose datatype is number at the database end.

should we wrap primary key (the integer value) using java wrapper classes and return it from ejbCreate method.
 
warren li
Ranch Hand
Posts: 128
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. use the wrapper classes.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic