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

Thinking about this a bit more, I would say that it would be a good idea 
1) to check if Mysql+MyISAM are running in any of the tables and
1a) refuse to work or
1b) make it a big warning and
2) to not use MyISAM when generating tables.

I don't know if it's possible to make flush behave differently on MyISAM to avoid this issue altogether.


On 26.02.2009, at 13:24, Gregor Zeitlinger wrote:

I was using MyISAM. I just checked that 

1) MyISAM does not support transactions - which is probably why you cannot do a thing about it
2) It works with InnoDB

On 25.02.2009, at 17:52, Gordon Yorke wrote:

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
eclipselink-dev mailing list

eclipselink-dev mailing list

Back to the top