• Post Reply Bookmark Topic Watch Topic
  • New Topic

automatic generation of primary keys for CMP Entity EJB  RSS feed

 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am using CMP Entity bean
How to map automatic generation of primary keys ?
(In Database primary key is autogenerated Number)
I am getting null pointer exception when this code
getting executed because I am not calling setID(Long) method in
my bean implementation class.
-- my primary key class looks like--

I am getting Null Pointer Exception in the hashCode() method
because I am not setting ID(because it is auto generated)
how to handle auto generated primary keys in container Managed Beans?
Thanks in Advance
vishnu
 
Sri Basavanahally
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vishnu, you should not use setters in your primary key class. Just thought I'd point that out.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!