[seam-commits] Seam SVN: r10359 - branches/community/Seam_2_0/src/main/org/jboss/seam/persistence.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Wed Apr 8 18:26:20 EDT 2009
Author: dan.j.allen
Date: 2009-04-08 18:26:20 -0400 (Wed, 08 Apr 2009)
New Revision: 10359
Modified:
branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceContexts.java
branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceProvider.java
Log:
JBSEAM-3030 fix regression where actual flush mode was not being restored after render
Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2009-04-08 21:55:33 UTC (rev 10358)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/HibernatePersistenceProvider.java 2009-04-08 22:26:20 UTC (rev 10359)
@@ -145,7 +145,7 @@
@Override
public void setRenderFlushMode()
{
- PersistenceContexts.instance().changeFlushMode(FlushModeType.MANUAL);
+ PersistenceContexts.instance().changeFlushMode(FlushModeType.MANUAL, true);
}
@Override
Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceContexts.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceContexts.java 2009-04-08 21:55:33 UTC (rev 10358)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceContexts.java 2009-04-08 22:26:20 UTC (rev 10359)
@@ -36,7 +36,7 @@
private static final LogProvider log = Logging.getLogProvider(PersistenceContexts.class);
private Set<String> set = new HashSet<String>();
private FlushModeType flushMode = FlushModeType.AUTO;
- private FlushModeType actualFlushMode = FlushModeType.AUTO;
+ private FlushModeType originalFlushMode;
public FlushModeType getFlushMode()
{
@@ -69,11 +69,18 @@
return null;
}
}
-
+
public void changeFlushMode(FlushModeType flushMode)
{
+ changeFlushMode(flushMode, false);
+ }
+
+ public void changeFlushMode(FlushModeType flushMode, boolean temporary)
+ {
+ if (temporary) {
+ this.originalFlushMode = this.flushMode;
+ }
this.flushMode = flushMode;
- this.actualFlushMode = flushMode;
changeFlushModes();
}
@@ -102,13 +109,14 @@
// some JPA providers may not support MANUAL flushing
// defer the decision to the provider manager component
PersistenceProvider.instance().setRenderFlushMode();
- changeFlushModes();
}
public void afterRender()
{
- flushMode = actualFlushMode;
- changeFlushModes();
+ if (originalFlushMode != null && originalFlushMode != flushMode) {
+ flushMode = originalFlushMode;
+ changeFlushModes();
+ }
}
}
Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceProvider.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceProvider.java 2009-04-08 21:55:33 UTC (rev 10358)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/PersistenceProvider.java 2009-04-08 22:26:20 UTC (rev 10359)
@@ -47,9 +47,11 @@
/**
* <p>
* Set the FlushMode the persistence contexts should use during rendering by
- * calling {@link PersistenceContexts#changeFlushMode(FlushModeType)}. The
+ * calling {@link PersistenceContexts#changeFlushMode(FlushModeType, boolean)}. The
* actual changing of the flush mode is handled by the
- * {@link PersistenceContexts} instance.
+ * {@link PersistenceContexts} instance. The boolean argument indicates whether
+ * the flush mode is temporary and should be set to true. The original flush
+ * mode will be restore after rendering is complete.
* </p>
* <p>
* Ideally, this should be MANUAL since changes should never flush to the
More information about the seam-commits
mailing list