From: Erik Brakkee Date: Sat, 24 Jul 2010 00:19:46 +0000 (+0000) Subject: (no commit message) X-Git-Tag: wamblee-utils-0.7~183 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=eb7794c4cc170c58a514dde099f87c9840a19472;hp=244dea78bca6dd782c550387e72b436bf2210182;p=utils --- diff --git a/wicket/components/src/main/java/org/wamblee/wicket/behavior/FlushEntityManagerBehavior.java b/wicket/components/src/main/java/org/wamblee/wicket/behavior/FlushEntityManagerBehavior.java index 921f779f..9ab5dda6 100644 --- a/wicket/components/src/main/java/org/wamblee/wicket/behavior/FlushEntityManagerBehavior.java +++ b/wicket/components/src/main/java/org/wamblee/wicket/behavior/FlushEntityManagerBehavior.java @@ -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); } }