• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error while calling create() method

 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I am working with Pramati Studio 3.0( product) and MySQL.I have created a CMP 2.0 Entity Bean.I have a form in which there are textfields for name and age.
In my table I have three fields ID,name,age.The first time I call the bean from the servlet,the values for ID,name and age get inserted in the table.But if I try to fill out the form again with new name and age I get this error....
A record already exists for pk == 0
Can anybody please explain this?
Regards
sanj
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using the same value in the id field and ID is the primary key of your entity bean, then this is what you should expect to happen.
Kyle
 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kyle
Thanks for the reply.The ID field is the primary key in the table.What happens if I set the ID field to be Autoincrement.....in that case do I have to call setId() on the bean or the ID field will be incremented by itself.

Regards
sanj
 
gautam shah
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sanj singh:
Hi Kyle
Thanks for the reply.The ID field is the primary key in the table.What happens if I set the ID field to be Autoincrement.....in that case do I have to call setId() on the bean or the ID field will be incremented by itself.

Regards
sanj

itself
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic