Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 30018 invoked from network); 16 Nov 2006 15:09:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Nov 2006 15:09:31 -0000 Received: (qmail 35600 invoked by uid 500); 16 Nov 2006 15:09:39 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 35579 invoked by uid 500); 16 Nov 2006 15:09:39 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 35568 invoked by uid 99); 16 Nov 2006 15:09:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 07:09:39 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [129.170.17.107] (HELO mailhub2.dartmouth.edu) (129.170.17.107) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Nov 2006 07:09:25 -0800 Received: from newblitzen.Dartmouth.EDU (newblitzen.Dartmouth.EDU [129.170.208.36]) by mailhub2.dartmouth.edu (8.13.5/DND2.0/8.13.5) with ESMTP id kAGElDpp024240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Nov 2006 10:07:08 -0500 X-Disclaimer: This message was received from outside Dartmouth's BlitzMail system. Received: by newblitzen.Dartmouth.EDU (Mac) via SMTP from atlantis.dhcp.HITCHCOCK.ORG [130.189.206.36] for dev@ibatis.apache.org id <85789901> 16 Nov 2006 10:07:08 -0500 Message-ID: <455C7E9B.2010502@dartmouth.edu> Date: Thu, 16 Nov 2006 10:07:07 -0500 From: Peter Andrews User-Agent: Thunderbird 1.5.0.8 (X11/20061107) MIME-Version: 1.0 To: dev@ibatis.apache.org Subject: Caught exception: 'Duplicate prepared statement found. This is likely a bug.' Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner: Found to be clean by mailhub2.Dartmouth.EDU X-MailScanner-From: peter.andrews@dartmouth.edu X-Virus-Checked: Checked by ClamAV on apache.org I posted a more complicated instance of this bug to the java user's group but since I think it is an iBATIS bug here is again with simplified description and test case. I am running the current subversion code. The basic issue is that if I have a complex resultMap that calls another statement, the processing of the second object that is created gets a duplicate prepared statement exception. The iBATIS code that is throwing the exception is in SessionScope.java: public void putPreparedStatement(String sql, PreparedStatement ps) { if (!isInBatch()) { if (hasPreparedStatementFor(sql)) throw new SqlMapException("Duplicate prepared statement found. This is likely a bug."); preparedStatements.put(sql, ps); } } Changing the iBATIS code to: if (!hasPreparedStatementFor(sql)) preparedStatements.put(sql, ps); appears to fix the problem. I am an iBATIS novice user so is likely not a correct fix (if the problem is even iBATIS'). Here is the relevant section of my sqlMap xml file: CALL getGeneExperimentResultsByDatasetExperimentId(#pDatasetExperimentId:NUMERIC#) CALL getGeneKeyById(#pGeneKeyId:NUMERIC#) Here is the console output showing the objects being created and the exception: DEBUG: queryForList 'getGeneExperimentResultsByDatasetExperimentId' passing: 1 DEBUG: org.epistasis.db.geneDataset.GeneKey created. DEBUG: org.epistasis.db.geneDataset.GeneKey id set to: 1 DEBUG: org.epistasis.db.geneDataset.GeneExperimentResult created. DEBUG: org.epistasis.db.geneDataset.GeneExperimentResult id set to: 1 com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in org/epistasis/db/geneDataset/GeneDataset.xml. --- The error occurred while applying a result map. --- Check the GeneDataset.resultMapGeneExperimentResult. --- Check the result mapping for the 'geneKey' property. --- Cause: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in org/epistasis/db/geneDataset/GeneDataset.xml. --- The error occurred while executing query. --- Check the CALL getGeneKeyById(?) . --- Check the SQL Statement (preparation failed). --- Cause: com.ibatis.sqlmap.client.SqlMapException: Duplicate prepared statement found. This is likely a bug. My SqlMapConfig is very unexceptional: -- Peter Andrews Software Engineer Dartmouth Medical School Computational Genetics Rubin 707 (603) 653-3598 Peter.Andrews@dartmouth.edu