ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Henrique Ferreira e Silva <dhsi...@gmail.com>
Subject Re: Multiple queries in one call
Date Tue, 12 Jul 2005 13:31:58 GMT
Hi Brian,

Can't you wrap the statements in a stored procedure?

Cheers,
Daniel Silva.

On 7/11/05, Barnett, Brian W. <brian.barnett@pearson.com> wrote:
> Tried a ";" and got the error below. Maybe I should take Niels advice and
> not use the SQL injection ??
> 
> Caused by:
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in com/scholar/model/map/StudentProfileSQL.xml.
> --- The error occurred while applying a parameter map.
> --- Check the getStudentProfileDataCombined-InlineParameterMap.
> --- Check the results (failed to retrieve results).
> --- Cause: java.lang.NullPointerException
> ...
> 
> java.lang.NullPointerException
>         at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.ja
> va:47)
>         at $Proxy62.close(Unknown Source)
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.closeResultSet(SqlExecutor.ja
> va:392)
>         at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java
> :191)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(
> GeneralStatement.java:201)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWith
> Callback(GeneralStatement.java:169)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForL
> ist(GeneralStatement.java:119)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExec
> utorDelegate.java:610)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExec
> utorDelegate.java:584)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionIm
> pl.java:105)
>         at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl
> .java:77)
>         at
> com.scholar.model.dao.SQLMapDao.executeQueryForList(SQLMapDao.java:42)
> 
> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Monday, July 11, 2005 3:05 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Multiple queries in one call
> 
> 
> try a ";" between the sql stmts.
> 
> On 7/11/05, Barnett, Brian W. <brian.barnett@pearson.com> wrote:
> > Anyone know how to make something like this work in MS SQL Server? I
> > have two select statements, the first selects into a temp table and
> > the second selects from the temp table. I want to do it in one call to
> > the db. I need help with the SQL. I can execute both queries in SQL
> > Query Analyzer just fine, but I can't when I use iBATIS. Is there a
> > different syntax I need to use?
> >
> > The SQL is something like this:
> > SELECT col1, col2 FROM table1 INTO ##mytemptable
> > JOIN table2 ON blah blah
> > JOIN table3 ON blah blah
> > WHERE blah blah
> >
> > SELECT DISTINCT col1, col2 FROM ##mytemptable
> >
> >
> > SQL Map snippet:
> > <select id="getData" resultMap="result_map"
> > parameterClass="java.util.HashMap">
> >         $sql$
> > </select>
> >
> > TIA,
> > Brian Barnett
> >
> > **********************************************************************
> > ******
> > This email may contain confidential material.
> > If you were not an intended recipient,
> > Please notify the sender and delete all copies.
> > We may monitor email to and from our network.
> >
> ****************************************************************************
> >
> 
> ****************************************************************************
> This email may contain confidential material.
> If you were not an intended recipient,
> Please notify the sender and delete all copies.
> We may monitor email to and from our network.
> ****************************************************************************
>

Mime
View raw message