ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <lmead...@apache.org>
Subject Re: Parameter Maps AND dynamic sql at the same time
Date Fri, 28 Oct 2005 12:11:21 GMT
There is something else going wrong here..

In the stack trace, it shows this message:
"Check the Supplier.insertSupplierExtras-InlineParameterMap"

That tells me that you were running "insertSupplierExtras" with an inline
parameter map.

But the statement sent was "updateSupplierExtras" with an explicit parameter
map.

I know that dynamic SQL and parameter maps work, so I think we are missing
some pieces of the puzzle here.

Larry


PS: Can you please trim the massive disclaimer, or use another account when
posting? GMail is free, and works great for this stuff.


On 10/28/05, Gareth Moorst <Gareth.Moorst@phones4u.co.uk> wrote:
>
> I'm trying to write insert/update statements that can have their table
> dynamically altered, but I'm having problems with any statements that use
> parameter maps...
>
> <update id="updateSupplierExtras" parameterMap="SupplierExtrasParam">
> update <dynamic><isEqual property="status"
> compareValue="1">supplierextrastm</isEqual><isEqual property="status"
> compareValue="0">supplierextras</isEqual></dynamic> set
> preferredsupplier = ?,
> contactname = ?,
> websiteaddress = ?,
> companyregno = ?,
> emailaddress=?
> where supplier=?
> </update>
>
> If I use inline parameters, then I don't have a problem, but when I try to
> use either a <dynamic> clause or a $tableName$ clause in the map, I get this
> error :
>
>
> DEBUG [AWT-EventQueue-0] - {pstm-100017} PreparedStatement: insert into
> supplierextrastm ( preferredsupplier, contactname, websiteaddress,
> companyregno, emailaddress, supplier) values (?, ?, ?, ?, ?, ?)
> DEBUG [AWT-EventQueue-0] - {pstm-100017} Parameters: []
> DEBUG [AWT-EventQueue-0] - {pstm-100017} Types: []
> WARN [AWT-EventQueue-0] - Error saving supplier
> org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
> operation; uncategorized SQLException for SQL []; SQL state [IX000]; error
> code [-79749];
> --- The error occurred while applying a parameter map.
> --- Check the Supplier.insertSupplierExtras-InlineParameterMap.
> --- Check the statement (update failed).
> --- Cause: java.sql.SQLException: Number of input values does not match
> number of question marks;
>
> Looking at the trace, it seems that when I use any form of dynamic sql,
> none of the parameters are passed. Is this the correct behaviour? Is it
> possible to use dynamic sql and parameter maps at the same time?
>
> I'm using iBatis 2.1.5.
>
> Cheers,
> Gareth Moorst
>
>

Mime
View raw message