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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 27 23:04:47 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-08-27 23:04:47 -0400 (Mon, 27 Aug 2007)
New Revision: 3062

Modified:
   trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
Log:
Fix for Oracle

Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-08-27 22:03:29 UTC (rev 3061)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-08-28 03:04:47 UTC (rev 3062)
@@ -558,7 +558,7 @@
 	      		Iterator iter = references.iterator();
 	
 	         	psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
-	         	psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_CONDITIONAL"));
+	         	psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
 	
 	         	while (iter.hasNext())
 	         	{
@@ -582,16 +582,28 @@
 	
 	         		//Maybe we need to persist the message itself
 	         		Message m = ref.getMessage();
-	
-	         		//We always try and insert the message, even if it might already be paged -
-	         		//we use a conditional insert though, so it won't insert it if it already exists
 
-      				storeMessage(m, psInsertMessage); 
-      				psInsertMessage.setLong(9, m.getMessageID());
+                  if (!m.isPersisted())
+                  {
+                     if (trace)
+                     {
+                        log.trace("Storing message " + m);
+                     }
+                     try
+                     {
+                        storeMessage(m, psInsertMessage);
 
-      			   rows = psInsertMessage.executeUpdate();
+                        rows = psInsertMessage.executeUpdate();
+                     }
+                     catch (SQLException e)
+                     {
+                        log.warn("An exception happened while storing message (probably a duplicated key)", e);
+                     }
+
+                     m.setPersisted(true);
+                  }
       				
-      				if (trace) { log.trace("Inserted " + rows + " rows"); }	               
+                  if (trace) { log.trace("Inserted " + rows + " rows"); }
 	         	} 
 	         	
 	         	return null;




More information about the jboss-cvs-commits mailing list