Author: adamw
Date: 2008-08-30 03:58:01 -0400 (Sat, 30 Aug 2008)
New Revision: 132
Modified:
trunk/src/main/org/jboss/envers/synchronization/VersionsSync.java
trunk/src/main/org/jboss/envers/synchronization/VersionsSyncManager.java
Log:
ENVERS-46: manual flush mode exception fix
Modified: trunk/src/main/org/jboss/envers/synchronization/VersionsSync.java
===================================================================
--- trunk/src/main/org/jboss/envers/synchronization/VersionsSync.java 2008-08-25 09:40:59
UTC (rev 131)
+++ trunk/src/main/org/jboss/envers/synchronization/VersionsSync.java 2008-08-30 07:58:01
UTC (rev 132)
@@ -24,6 +24,7 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.FlushMode;
+import org.hibernate.event.EventSource;
import org.jboss.envers.synchronization.work.VersionsWorkUnit;
import org.jboss.envers.tools.Pair;
import org.jboss.envers.revisioninfo.RevisionNumberGenerator;
@@ -37,7 +38,7 @@
public class VersionsSync implements Synchronization {
private final RevisionNumberGenerator revisionNumberGenerator;
private final VersionsSyncManager manager;
- private final Session session;
+ private final EventSource session;
private final Transaction transaction;
private final LinkedList<VersionsWorkUnit> workUnits;
@@ -46,7 +47,7 @@
private Number revision;
- public VersionsSync(VersionsSyncManager manager, Session session,
RevisionNumberGenerator revisionNumberGenerator) {
+ public VersionsSync(VersionsSyncManager manager, EventSource session,
RevisionNumberGenerator revisionNumberGenerator) {
this.manager = manager;
this.session = session;
this.revisionNumberGenerator = revisionNumberGenerator;
@@ -125,11 +126,14 @@
return;
}
+ System.out.println("FLUSH MODE: " + session.getFlushMode());
+
if (FlushMode.isManualFlushMode(session.getFlushMode())) {
Session temporarySession = null;
try {
//noinspection deprecation
- temporarySession =
session.getSessionFactory().openSession(session.connection());
+ //temporarySession =
session.getSessionFactory().openSession(session.connection());
+ temporarySession = session.getFactory().openTemporarySession();
executeInSession(temporarySession);
Modified: trunk/src/main/org/jboss/envers/synchronization/VersionsSyncManager.java
===================================================================
--- trunk/src/main/org/jboss/envers/synchronization/VersionsSyncManager.java 2008-08-25
09:40:59 UTC (rev 131)
+++ trunk/src/main/org/jboss/envers/synchronization/VersionsSyncManager.java 2008-08-30
07:58:01 UTC (rev 132)
@@ -23,8 +23,8 @@
import org.jboss.envers.tools.ConcurrentReferenceHashMap;
import org.jboss.envers.revisioninfo.RevisionNumberGenerator;
-import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.event.EventSource;
import java.util.Map;
@@ -43,7 +43,7 @@
this.revisionNumberGenerator = revisionNumberGenerator;
}
- public VersionsSync get(Session session) {
+ public VersionsSync get(EventSource session) {
Transaction transaction = session.getTransaction();
VersionsSync verSync = versionsSyncs.get(transaction);
Show replies by date