Just wanted to say thanks for fixing this. Whenever one finds an issue
in an open source project, it takes time to report it in a useful
manner. Sometimes in the press of getting projects done, if you come up
with a workaround for yourself, it is tempting to not bother reporting
it, figuring 'someone else will do it'. Seeing bug reports taken
seriously and used to improve the product rewards the expenditure of
effort taken to report them and makes us a community rather than just
producers and consumers, even if just a little.
Clinton Begin (JIRA) wrote:
Prepared statement caching...Duplicate prepared statement found. This is likely
a bug.
--------------------------------------------------------------------------------------
Key: IBATIS-369
URL: http://issues.apache.org/jira/browse/IBATIS-369
Project: iBatis for Java
Issue Type: Bug
Affects Versions: 2.2.1
Reporter: Clinton Begin
Assigned To: Clinton Begin
http://www.mail-archive.com/user-java@ibatis.apache.org/msg06919.html
----
I am sorry if this has been discussed previously -- the mail archives seem to
be currently unavailable (get network connection error).
I am getting an error. The error message is different between 2.2.0 and the
subversion latest. The error in the subject line is from the subversion code.
In the 2.2.0 I get:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Result consisted of more
than one row
When the message says 'This is likely a bug' does it mean a bug in iBATIS or a
bug in my code? I think it means iBATIS.
At the bottom of this email is a partial stack trace (the full trace goes on
for a very long time repeating itself and ends with '...30 more').
I think the issue is that one of my calls into iBATIS can cause additional
calls to occur before the first one ends. This is because some of my setter
functions also make calls to the db.
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 stack trace:
run-single:
DEBUG: iBATIS SqlMap for db 'GeneDataset' initialized
DEBUG: queryForObject 'getResearcherByUsername' passing: PeterVermont
DEBUG: queryForObject 'getResearcherByUsername' returning:
org.epistasis.db.geneExperiment.Researcher[id=1] DEBUG: queryForList
'getGeneExperimentResultsByDatasetExperimentId' passing: 1
<==*********************NOTE: Still in process when when following calls start
DEBUG: queryForObject 'getGeneKeyById' passing: 1
DEBUG: queryForObject 'getGeneKeyById' returning:
org.epistasis.db.geneExperiment.GeneKey[id=1] DEBUG: queryForObject
'getGeneKeyById' passing: 2 <==*********************NOTE: second call to
getGeneKeyById since 'getGeneExperimentResultsByDatasetExperimentId' started
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. Caused by: com.ibatis.sqlmap.client.SqlMapException: Duplicate
prepared statement found. This is likely a bug. at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at
--
Peter Andrews
Software Engineer
Dartmouth Medical School
Computational Genetics
Rubin 707
(603) 653-3598
[EMAIL PROTECTED]