Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary Key generation in CMP EJB

 
Mohnish Saini
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends

I need to implement primarykey generation in CMP EJB. That primary key should be of string type.

I have already implemented the primary key generation using java.lang.Integer and java.lang.Long.
But i need to implement using java.lang.String.

<prim-key-class>java.lang.String</prim-key-class>

Please guide me.

Thanks
Mohnish
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohnish Saini wrote:I need to implement primarykey generation in CMP EJB. That primary key should be of string type.

Why can't you use Integer? Sequences are pretty standard for autogenerated keys.
 
Mohnish Saini
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a string because if I used Integer or Long in the java code, its max value is far less that the corresponding PK column which is Number(38) in the database. And it will give me Numeric Overflow exception.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic