*
The moose likes EJB and other Java EE Technologies and the fly likes error while calling create() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "error while calling create() method" Watch "error while calling create() method" New topic
Author

error while calling create() method

sanj singh
Ranch Hand

Joined: Jun 30, 2001
Posts: 129
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

Joined: Aug 10, 2001
Posts: 3892
    
    5
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


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
sanj singh
Ranch Hand

Joined: Jun 30, 2001
Posts: 129
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

Joined: Oct 29, 2000
Posts: 72
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
 
 
subject: error while calling create() method
 
Similar Threads
does request.getParameter return only String
EL and jsp:usebean..type/class
form field's value from a string
validwhen - struts validation
Advantage of Struts tag?