EJB programming & troubleshooting: DuplicateKey exception while inserting record
- Posted by: sanjay gandhi
- Posted on: August 04 2000 04:14 EDT
I am using Websphere Application server 3.02. I am getting a strange error while using entity bean.
In my process, based on some business conditions i delete a record using the remove() method of entity bean.
After deleting record if i try to insert a record using create() method of entity bean with same primary key i get DuplicateKey Exception.
Any help on this would be appreciated.
- DuplicateKey exception while inserting record by Shriram Mogallapalli on August 04 2000 12:00 EDT
- DuplicateKey exception while inserting record by Aaron Robinson on May 20 2003 17:20 EDT
are you using CMP or BMP. If BMP (Bean Managed Persistence) check your database to C your DB record is getting deleted. There could be bug in you remove code?
just in case?
I have CMP in my entity bean.
Have you ever solved this problem?
Is the remove failing silently?
I would recomend reviewing the primary key generation strategy in the first place.
There is a nice thread in the subject here