ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <brandon.goo...@gmail.com>
Subject Re: com.ibatis.sqlmap.client.SqlMapException: Duplicate prepared statement found. This is likely a bug.
Date Tue, 14 Nov 2006 18:02:25 GMT
Please post your code involved in producing this. Post sqlmap config, dao
java code, and bean java code.

Brandon

On 11/14/06, Peter Andrews <peter.andrews@dartmouth.edu> wrote:
>
> 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
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject
> (GeneralStatement.java:104)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(
> SqlMapExecutorDelegate.java:566)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(
> SqlMapExecutorDelegate.java:541)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(
> SqlMapSessionImpl.java:106)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(
> SqlMapClientImpl.java:83)
>         at
> org.epistasis.db.SqlMapClientWrapper.queryForObject(
> SqlMapClientWrapper.java:21)
>         at
> org.epistasis.db.geneDataset.GeneDatasetDbAccess.getGeneKeyById(
> GeneDatasetDbAccess.java:94)
>         at
> org.epistasis.db.geneDataset.GeneKey.getGeneKeyById(GeneKey.java:49)
>         at
> org.epistasis.db.geneDataset.GeneExperimentResult.setGeneKeyId(
> GeneExperimentResult.java:110)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at
> com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(
> PropertyAccessPlan.java:46)
>         at
> com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(
> JavaBeanDataExchange.java:115)
>         at
>
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues
> (BasicResultMap.java:373)
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject
> (RowHandlerCallback.java:64)
> ERROR: Caught an exception
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(
> SqlExecutor.java:377)
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(
> SqlExecutor.java:296)
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(
> SqlExecutor.java:187)
> com.ibatis.common.jdbc.exception.RuntimeSQLException:
> 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 getGeneExperimentResultsByDatasetExperimentId-AutoResultMap.
> --- The error happened while setting a property on the result object.
> --- Cause: java.lang.RuntimeException: Error setting property
> 'setGeneKeyId' of
> 'org.epistasis.db.geneExperiment.GeneExperimentResult[id=2]'.  Cause:
> com.ibatis.common.jdbc.exception.RuntimeSQLException:
> 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.
> Caused by: java.lang.RuntimeException: Error setting property
> 'setGeneKeyId' of
> 'org.epistasis.db.geneExperiment.GeneExperimentResult[id=2]'.  Cause:
> com.ibatis.common.jdbc.exception.RuntimeSQLException:
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in org/epistasis/db/geneDataset/GeneDataset.xml.
> --- The error occurred while executing query.
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery
> (GeneralStatement.java:205)
> --- Check the      CALL getGeneKeyById(?)   .
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
> (GeneralStatement.java:173)
> --- Check the SQL Statement (preparation failed).
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList
> (GeneralStatement.java:123)
> --- Cause: com.ibatis.sqlmap.client.SqlMapException: Duplicate prepared
> statement found.  This is likely a bug.
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:615)
> Caused by: com.ibatis.sqlmap.client.SqlMapException: Duplicate prepared
> statement found.  This is likely a bug.
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:589)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(
> SqlMapSessionImpl.java:118)
>         at
> org.epistasis.db.SqlMapClientWrapper.queryForList(SqlMapClientWrapper.java
> :50)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(
> SqlMapClientImpl.java:95)
>         at
>
> org.epistasis.db.geneDataset.GeneDatasetDbAccess.getGeneExperimentResultsByDatasetExperimentId
> (GeneDatasetDbAccess.java:90)
>         at
> org.epistasis.db.SqlMapClientWrapper.queryForList(SqlMapClientWrapper.java
> :45)
>         at
> org.epistasis.db.geneDataset.GeneDatasetDbAccess.main(
> GeneDatasetDbAccess.java:167)
>         at
>
> org.epistasis.db.geneDataset.GeneDatasetDbAccess.getGeneExperimentResultsByDatasetExperimentId
> (GeneDatasetDbAccess.java:90)
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
>         at
> org.epistasis.db.geneDataset.GeneDatasetDbAccess.main(
> GeneDatasetDbAccess.java:167)
> --- The error occurred in org/epistasis/db/geneDataset/GeneDataset.xml.
> Caused by: com.ibatis.sqlmap.client.SqlMapException: Duplicate prepared
> statement found.  This is likely a bug.
> --- The error occurred while applying a result map.
>         at
> com.ibatis.sqlmap.engine.scope.SessionScope.putPreparedStatement(
> SessionScope.java:247)
> --- Check the getGeneExperimentResultsByDatasetExperimentId-AutoResultMap.
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.prepareStatement(
> SqlExecutor.java:488)
> --- The error happened while setting a property on the result object.
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(
> SqlExecutor.java:173)
> --- Cause: java.lang.RuntimeException: Error setting property
> 'setGeneKeyId' of
> 'org.epistasis.db.geneExperiment.GeneExperimentResult[id=2]'.  Cause:
> com.ibatis.common.jdbc.exception.RuntimeSQLException:
> com.ibatis.common.jdbc.exception.NestedSQLException:
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery
> (GeneralStatement.java:205)
> --- The error occurred in org/epistasis/db/geneDataset/GeneDataset.xml.
>         at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
> (GeneralStatement.java:173)
> --- The error occurred while executing query.
>         ... 30 more
>
> --
> Peter Andrews
> Software Engineer
> Dartmouth Medical School
> Computational Genetics
> Rubin 707
> (603) 653-3598
> Peter.Andrews@dartmouth.edu
>
>

Mime
View raw message