Property substitutions do not occur inside <selectKey> statement
----------------------------------------------------------------
Key: IBATISNET-21
URL: http://issues.apache.org/jira/browse/IBATISNET-21
Project: iBatis for .NET
Type: Bug
Versions: DataMapper 1.1
Environment: Windows 2003 Server, IBatis DataMapper v1.0.1.321
Reporter: Ron Grabowski
When using a properties file:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<add key="userid" value="xxxxx" />
<add key="password" value="xxxxx" />
<add key="database" value="xxxxx" />
<add key="datasource" value="xxxxx" />
<add key="selectKey" value="SELECT CAST(@@IDENTITY as int) as value" />
<add key="now" value="GETDATE()" />
<add key="true" value="1" />
<add key="false" value="0" />
</settings>
Substitutions work as expected except for the <selectKey> statement:
<!-- OK -->
<database>
<provider name="sqlServer1.1"/>
<dataSource name="xxxxx" connectionString="data
source=${datasource};database=${database}..."/>
</database>
<!-- OK -->
<insert id="AddressInsert" parameterClass="Address">
INSERT INTO Address
(
Street,
City,
Zip,
DateAdded
)
VALUES
(
#Street#,
#City#,
#Zip#,
${now}
)
</insert>
<!-- WRONG -->
<insert id="AddressInsert" parameterClass="Address">
INSERT INTO Address
(
Street,
City,
Zip,
DateAdded
)
VALUES
(
#Street#,
#City#,
#Zip#,
${now}
)
<selectKey property="AddressId" type="post" resultClass="int">
${selectKey}
</selectKey>
</insert>
In the last example, ${selectKey} is not replaced by the value defined in the
properties file. The log file incorrectly list this:
'AddressInsert': INSERT INTO Address (Street, City, Zip, DateAdded) VALUES
(@Street, @City, @zip, GETDATE())
'AddressInsert.SelectKey' :${selectKey}
It should be:
'AddressInsert': INSERT INTO Address (Street, City, Zip, DateAdded) VALUES
(@Street, @City, @zip, GETDATE())
'AddressInsert.SelectKey' : SELECT CAST(@@IDENTITY as int) as value
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira