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

Have you created the MYSQL database with the INNIDB engine?  Have you tried your example on another database?

Gregor Zeitlinger wrote:
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 {

_______________________________________________ eclipselink-dev mailing list eclipselink-dev@xxxxxxxxxxx

Back to the top