users@glassfish.java.net

Toplink delete entity not working

From: <glassfish_at_javadesktop.org>
Date: Thu, 02 Apr 2009 02:04:29 PDT

Hi,
Trying to delete an entity causing some strange behauviour. After entityManager.remove() the entity didn't disappear in the database. This I solved by adding an entityManager.flush() and the entity disappeared from the database. I need to mention that the program cannot find the removed entity which is still in the database.

Problem solved, but wait... Trying to add an entity with the same primary key as the deleted one causes an Exception can't persist detach object because duplicate primary key.

Restarting is solving the problem, but not usable. So how can I correctly remove entities from the database and release the primary keys, so the can be reused. And Is it possible to remove the entity without calling flush.

Any pointer will be helpfull

Johan
[Message sent by forum member 'jcstover' (jcstover)]

http://forums.java.net/jive/thread.jspa?messageID=340196