You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Clinton Begin (JIRA)" <ib...@incubator.apache.org> on 2006/11/21 06:51:02 UTC

[jira] Closed: (IBATIS-369) Prepared statement caching...Duplicate prepared statement found. This is likely a bug.

     [ http://issues.apache.org/jira/browse/IBATIS-369?page=all ]

Clinton Begin closed IBATIS-369.
--------------------------------

    Resolution: Fixed

Fixed.

> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira