Author: fancy
Date: Tue Jun 10 07:45:59 2008
New Revision: 666137

URL: http://svn.apache.org/viewvc?rev=666137&view=rev
Log:
OPENJPA-631 provide detailed SQLException for batched statements that 
encountered error in DB2

Modified:
    
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Modified: 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=666137&r1=666136&r2=666137&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
 (original)
+++ 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
 Tue Jun 10 07:45:59 2008
@@ -531,11 +531,19 @@
 
             String Warn = new String((char[]) getSqlWarnMethd.
                     invoke(sqlca, new Object[]{}));
-            if(Warn.trim().length() != 0)
+            if (Warn.trim().length() != 0)
                 exceptionMsg = exceptionMsg.concat(", Warn=" +Warn + "]" );
             else
                 exceptionMsg = exceptionMsg.concat( "]" );
             msg = msg.concat(exceptionMsg);
+            
+            // for batched execution failures, SQLExceptions are nested
+            SQLException sqle2 = sqle.getNextException();
+            while (sqle2 != null) {                
+                msg = msg.concat("\n" + sqle2.getMessage());
+                sqle2 = sqle2.getNextException();
+            }
+            
             return msg;
         } catch (Throwable t) {
             return sqle.getMessage();


Reply via email to