users@glassfish.java.net

Glassfish CMP not cleaning up transactions

From: <forums_at_java.net>
Date: Thu, 19 May 2011 15:05:23 -0500 (CDT)

I have multiple EJB's using Container managed persistance.  I appear to be
leaving the transactions open, however, with CMP, I thought, its the
container that cleans up the transactions after a commit.  This problem may
also be me misunderstanding what I'm seeing.  Allow me to explain.

In glassfish (V2.1) I enable Monitoring of JTA and look at the Transactions
Tab.

I execute my program which invokes multiple EJB's that do inserts/updates to
my database.  In general, EJB's are marked with a TransactionAttribute of
NotSupported, with the actual method that does the insert as RequiresNew. 
So when I exit the method, it should commit.

After completion, the Transactions Tab shows multiple transactions, all
listed as "No Transaction" in the "State" column.  I do see some while the
program is running marked as "Active" and some of them do go away.  However,
it always leaves the transaction.  Some have been around over 67 hours. 
When I restart Glassfish, they go away.   I'm assuming this is a
transaction that was committed but not released.  These never seem to be
cleaned up.

My code is doing  injection for the entity manager and everything else is
either using em.createNamedQuery().getResultList(),
em.createQuery().executeUpdate(), or using the em.persist() or em.merge().

Am I missing something (glassfish parameter, etc) or should I be doing some
kind of close() in my code. 

Thanks for your help

 


--
[Message sent by forum member 'gsarrowood']
View Post: http://forums.java.net/node/804259