persistence@glassfish.java.net

RE: Remove Problem

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 10 Jul 2006 11:45:40 -0400

Hello,
    When the beans are persisted are you calling 'flush()' if not how are you finding the entity to delete in the second bean? Are you using the remove API or 'delete from' JPQL? If you are calling flush in the first bean and 'remove()' in the second then I do not anticipate any problems, but if you are not calling flush() in the first bean then that EntityManger will flush the new objects at the end of the transaction. You could switch to use a transacational entity manager. Can you provide the code that is making the persistence calls?
--Gordon

-----Original Message-----
From: Joerg Lauer [mailto:lauer_at_osiag.de]
Sent: Monday, July 10, 2006 11:33 AM
To: persistence_at_glassfish.dev.java.net
Subject: Remove Problem


Hi,

while running some performance tests I noticed that some entities
weren't removed, when they were created in the same transaction.

The entities were persisted, in another business method of another bean,
and afterwards removed. (I was using a fake home interface, for this test)

After the transaction finished, the removed entities were inserted into
the database.

If I skip the artificial home and persist and remove in the same method
(or even call methods on the same bean) everything works okay.

I'd like to know whether I'm making a fundamental mistake, or it's an
issue in toplink or glassfish.

I'm currently running Appserver 9, but glassfish v2 Build 08 showed the
same problem, both using toplink and JavaDB.

Regards

Joerg Lauer