From eb7794c4cc170c58a514dde099f87c9840a19472 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 24 Jul 2010 00:19:46 +0000 Subject: [PATCH 1/1] --- .../wicket/behavior/FlushEntityManagerBehavior.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); } } -- 2.31.1