svn commit: r574827 - /lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Wed Sep 12 01:00:57 2007
New Revision: 574827

URL: http://svn.apache.org/viewvc?rev=574827&view=rev
Log:
UnitOfWorkImpl.isDirty() does also check for new and removed objects

Modified:
    lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java

Modified: lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java?rev=574827&r1=574826&r2=574827&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/UnitOfWorkImpl.java Wed Sep 12 01:00:57 2007
@@ -89,8 +89,8 @@
     }
 
     /**
-     * Commit the transaction. We lock this method for the whole class to avoid
-     * synchronization problems.
+     * Commit the transaction. We lock this method for the whole class to avoid synchronization
+     * problems.
      * @see org.apache.lenya.transaction.UnitOfWork#commit()
      */
     public void commit() throws TransactionException {
@@ -134,7 +134,7 @@
                 Transactionable t = (Transactionable) i.next();
                 t.deleteTransactionable();
             }
-    
+
         } finally {
             if (getIdentityMap() != null) {
                 Object[] objects = getIdentityMap().getObjects();
@@ -172,12 +172,14 @@
      * @see org.apache.lenya.transaction.UnitOfWork#isDirty(org.apache.lenya.transaction.Transactionable)
      */
     public boolean isDirty(Transactionable transactionable) {
-        return this.modifiedObjects.contains(transactionable);
+        return this.modifiedObjects.contains(transactionable)
+                || this.newObjects.contains(transactionable)
+                || this.removedObjects.contains(transactionable);
     }
 
     /**
-     * Rollback the transaction. We lock this method for the whole class to
-     * avoid synchronization problems.
+     * Rollback the transaction. We lock this method for the whole class to avoid synchronization
+     * problems.
      * @see org.apache.lenya.transaction.UnitOfWork#rollback()
      */
     public synchronized void rollback() throws TransactionException {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.