(no commit message)
authorErik Brakkee <erik@brakkee.org>
Sat, 24 Jul 2010 00:19:46 +0000 (00:19 +0000)
committerErik Brakkee <erik@brakkee.org>
Sat, 24 Jul 2010 00:19:46 +0000 (00:19 +0000)
wicket/components/src/main/java/org/wamblee/wicket/behavior/FlushEntityManagerBehavior.java

index 921f779f73426de0e87af99c9e052d899f7044eb..9ab5dda6d5c4cd845cdb5e08c237d0ce4403eb9d 100644 (file)
@@ -20,6 +20,8 @@ import java.util.logging.Logger;
 
 import javax.annotation.Resource;
 import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+import javax.persistence.TransactionRequiredException;
 import javax.transaction.Status;
 import javax.transaction.SystemException;
 import javax.transaction.UserTransaction;
@@ -55,8 +57,12 @@ public class FlushEntityManagerBehavior extends AbstractPageBehavior {
             if (entityManager.isOpen()) {
                 entityManager.flush();
             }
-        } catch (Exception e) { // TODO catch the Entity manager exceptions explicitly and rethrow, but log
-                                 // the other onees.
+        } catch (TransactionRequiredException e) { 
+            throw e; 
+        } catch (PersistenceException e) { 
+            throw e;
+        }
+        catch (Exception e) { 
             LOGGER.log(Level.WARNING, "Could not flush entitymanager", e);
         }
     }