Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 44720 invoked from network); 9 Mar 2010 18:14:19 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Mar 2010 18:14:19 -0000 Received: (qmail 78688 invoked by uid 500); 9 Mar 2010 18:13:51 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 78653 invoked by uid 500); 9 Mar 2010 18:13:51 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 78645 invoked by uid 99); 9 Mar 2010 18:13:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 18:13:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 18:13:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 34AE3234C4B2 for ; Tue, 9 Mar 2010 18:13:27 +0000 (UTC) Message-ID: <1549578543.158351268158407200.JavaMail.jira@brutus.apache.org> Date: Tue, 9 Mar 2010 18:13:27 +0000 (UTC) From: "Donald Woods (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-699) SQLWarnings not handled properly with WarningAction set to "handle" In-Reply-To: <331275721.1219425884816.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donald Woods updated OPENJPA-699: --------------------------------- Fix Version/s: 2.0.0-M1 > SQLWarnings not handled properly with WarningAction set to "handle" > ------------------------------------------------------------------- > > Key: OPENJPA-699 > URL: https://issues.apache.org/jira/browse/OPENJPA-699 > Project: OpenJPA > Issue Type: Bug > Components: diagnostics > Affects Versions: 1.0.0 > Environment: Kodo 4.1.4 > OpenJPA 1.0.0 > MS SQL 2005 > MS JDBC DRIVER VERSION 1.1 > JDK 1.5 > Reporter: Xiaoqin Feng > Fix For: 2.0.0-M1 > > Attachments: openJPA-699-v2.patch, openJPA-699.patch > > > If set "kodo.ConnectionFactoryProperties" "warningAction" to "throw" or "handle", when an INSERT statement fails due > to an attempt to insert null into a non-null column, log output is "The statement has been > terminated". > If didn't set "warningAction", the default value is "ignore". It logs correct SQLException which is as follows: > Cannot > insert the value NULL into column 'TestTimeNotNullNoDefaultUtc', table > 'STADatabase.dbo.DefaultValuesJ'; column does not allow nulls. INSERT fails. > {prepstmnt 112461492 > ... ... > In org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.LoggingPreparedStatement.executeUpdate(), the > code is > public int executeUpdate(String sql) throws SQLException { > _sql = sql; > logSQL(this); > long start = System.currentTimeMillis(); > try { > return super.executeUpdate(sql); > } catch (SQLException se) { > throw wrap(se, LoggingStatement.this); > } finally { > logTime(start); > handleSQLWarning(LoggingStatement.this); > } > } > In this test case, it got a SQLWarning with msg 'The statement has been > terminated' and a SQLException which tells Column null is not allowed. > When WarningAction is set to 'throw' or 'handle' and if handle doesn't > consume the warning but throw it, the SQLWarning is thrown from finally > block. > The SQLWarning which it is a subclass of SQLException will be processed by > DBdictionary.newStoreException() so we see the incorrect message. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.