Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-dev] em.flush() stores data in database in a rolled back transaction

1. Is the EntityManager obtained by injection, i.e.  is it container-managed with JTA transaction type?
2. Can you verify that the container transaction was rolled back?
3. What container are you using?
-----Original Message-----
From: Gregor Zeitlinger [mailto:gregor.zeitlinger@xxxxxxxxxx]
Sent: Wednesday, February 25, 2009 11:09 AM
To: eclipselink-dev@xxxxxxxxxxx
Subject: [eclipselink-dev] em.flush() stores data in database in a rolled back transaction

I think I've found a bug in eclipselink, but before I file it, I want to be sure it's really a bug:

1) EntityManager.persist(..)
2) EntittyManager.flush()
3) the transaction is rolled back (because an exception is thrown)
4) The data from (1) is stored in the database (as seen from the mysql command line)

As I understand flush, it should not commit the data. From

As Example 29-29 shows, you can use EntityManager method flush to send updates to the database within a transaction before the transaction is committed.

Here's the test code to reproduce the bug

public class MetaStorage implements IMetaStorage, IMetaStorageRemote {

public void createDocument() {
Document document = new Document();

// flush to force ID update

throw new StorageException();

public class StorageException extends RuntimeException {

Back to the top