From ddc42e807837f340306dbbf2e9f04255f8437539 Mon Sep 17 00:00:00 2001 From: Catalina Wei Date: Tue, 10 Jun 2008 14:45:59 +0000 Subject: [PATCH] OPENJPA-631 provide detailed SQLException for batched statements that encountered error in DB2 git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@666137 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/jdbc/sql/DB2Dictionary.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java index bb90aedb4..cad3ed928 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java @@ -531,11 +531,19 @@ public class DB2Dictionary 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();