[jboss-cvs] JBoss Messaging SVN: r3088 - trunk/src/main/org/jboss/messaging/core/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 5 16:41:45 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-09-05 16:41:45 -0400 (Wed, 05 Sep 2007)
New Revision: 3088

Modified:
   trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
Log:
Fixing Insert dual for postgresql

Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-09-05 14:15:37 UTC (rev 3087)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-09-05 20:41:45 UTC (rev 3088)
@@ -158,6 +158,8 @@
                "                         Using an isolation level more strict than READ_COMMITTED may lead to deadlock.\n";
             log.warn(warn);
          }
+
+         log.debug("Adding record on JBM_DUAL");
          
          //Now we need to insert a row in the DUAL table if it doesn't contain one already
          ps = conn.prepareStatement(this.getSQLStatement("INSERT_DUAL"));
@@ -170,7 +172,12 @@
          }
          catch (SQLException e)
          {
+            wrap.exceptionOccurred();
+            wrap.end();
+            wrap = new TransactionWrapper();
 
+            log.debug("Checking for existance on JBM_DUAL");
+
             Statement selectCount = conn.createStatement();
             ResultSet rset = selectCount.executeQuery(this.getSQLStatement("CHECK_DUAL"));
             try
@@ -179,6 +186,7 @@
                // if JBM_DUAL has a line already, we don't care about the exception...
                if (!rset.next())
                {
+                  log.debug("JBM_DUAL didn't have a record.. throwing exception", e);
                   throw e;
                }
 
@@ -186,6 +194,7 @@
                // if there are two lines or more on JBM_DUAL, that is also a problem
                if (rset.next())
                {
+                  log.debug("duplicated record found on JBM_DUAL... throwing exception");
                   throw new IllegalStateException("JBM_DUAL is missing a primary key as it allowed a duplicate value");
                }
             }




More information about the jboss-cvs-commits mailing list