users@glassfish.java.net

Re: Glassfish does NOT do transactions?

From: <glassfish_at_javadesktop.org>
Date: Wed, 15 Oct 2008 06:08:52 PDT

As with the thread referred to, I am using MySQL Community Version 5 with the MySQL 5.0 JDBC Driver. This DB does have transactions.

I'm not sure what you mean about the thread making assumptions about commits. Let me summarize the problem sequence:

1. A message arrives in message bean started within a CMP JTA transaction
2. the bean creates an object and uses EntityManager to:
- persist(object)
- flush()
3. At this point in the sequence, the object has been committed to the DB by Glassfish EVEN THOUGH THE JTA TRANSACTION HAS NOT BEEN COMMITTED.
Doing a Rollback on the JTA transaction does NOT rollback the object in the DB.

Note that if we do not do the flush() on the EntityManager, the transaction sort of works as expected (ie: it does not show up in the DB until the transaction completes and it can be rolled back), but that object does not show up when the EntityManager does queries on the DB, so it is not fully participating in the current transaction.

An Application Server that claims to do transactions but does not allow rollbacks in the DB is simply not a usable environment. This is why I cannot believe that this problem has no solution in Glassfish. There must be something that someone can suggest for us to try that would make this work correctly. Hence my post.

As for making a test case, the previously posted code is the extract of our code that is not working. I may or may not have the time to create a complete stand-alone test case. If so I will post it. In the mean time, any suggestions would be appreciated.
[Message sent by forum member 'gwg' (gwg)]

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