You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by tech fan <mo...@gmail.com> on 2009/05/13 11:19:47 UTC
parameterMaps based on sequance instead of names?!
Hi,
I can not believe this, that the parameterMaps are based on sequance instead
of names. I'm using 1.6.2 and oracle, it seems to be so. I have a
definination here:
<parameterMaps>
<parameterMap id ="UpdateMap" class ="Process">
<parameter property ="Id" column="ID"/>
<parameter property="Name" column="NAME" />
<parameter property="Owner" column="OWNER" />
<parameter property="EMail" column="EMAIL"/>
<parameter property="Comments" column="COMMENTS"/>
<parameter property="Workflow.Id" column="PARENTID"/>
<parameter property="IsDeleted" column="ISDELETED"/>
</parameterMap>
</parameterMaps>
and sql is this
<insert id="Insert" parameterClass="Process" parameterMap="UpdateMap">
INSERT INTO process
(ID, NAME, OWNER, EMAIL, COMMENTS, OVERLAYS, PARENTID, ISDELETED)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?)
</insert>
if I switch the sequance of ISDELETE and PARENTID, in either sql or the
parameterMap, then it always generates error. (ISDELETED is varchar2(1))
Anyone encountered this?
Regards,
T.M.
RE: parameterMaps based on sequance instead of names?!
Posted by "Nicholas L. Piasecki" <ni...@piasecki.name>.
I believe that is by design, and it's a pattern that you'll see in many
different data access scenarios (for example, the MySQL driver on .NET).
Since iBATIS.NET doesn't have an actual MySQL, T-SQL etc parser, it doesn't
know in what order to apply the parameters based on the column attribute
alone. It would be nice if the property style syntax (#Name#) were
supported, but I don't think that it is; perhaps someone else could give an
insightful reason as to why. The column attribute is, I believe, only
required for OUT parameters when calling stored procedures.
I remember making the same assumption and also being astonished, but it does
make some degree of sense when you think about it. To iBATIS, the resulting
SQL is still "just a string."
Hope that helps.
V/R,
Nicholas Piasecki
From: tech fan [mailto:monstercorp@gmail.com]
Sent: Wednesday, May 13, 2009 5:20 AM
To: user-cs@ibatis.apache.org
Subject: parameterMaps based on sequance instead of names?!
Hi,
I can not believe this, that the parameterMaps are based on sequance instead
of names. I'm using 1.6.2 and oracle, it seems to be so. I have a
definination here:
<parameterMaps>
<parameterMap id ="UpdateMap" class ="Process">
<parameter property ="Id" column="ID"/>
<parameter property="Name" column="NAME" />
<parameter property="Owner" column="OWNER" />
<parameter property="EMail" column="EMAIL"/>
<parameter property="Comments" column="COMMENTS"/>
<parameter property="Workflow.Id" column="PARENTID"/>
<parameter property="IsDeleted" column="ISDELETED"/>
</parameterMap>
</parameterMaps>
and sql is this
<insert id="Insert" parameterClass="Process" parameterMap="UpdateMap">
INSERT INTO process
(ID, NAME, OWNER, EMAIL, COMMENTS, OVERLAYS, PARENTID, ISDELETED)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?)
</insert>
if I switch the sequance of ISDELETE and PARENTID, in either sql or the
parameterMap, then it always generates error. (ISDELETED is varchar2(1))
Anyone encountered this?
Regards,
T.M.