Dashboard > iBATIS DataMapper > Home > Frequently Asked Questions > Complex properties and substitution strings parameter problem
Complex properties and substitution strings parameter problem
Added by Nguyen Hoan, last edited by Nguyen Hoan on Jan 17, 2007
Labels: 
(None)


Hi!

I'm developing a web app with ibatis (2.2) and have got a problem with complex properties and passing substitution strings parameter for sql query of properties.

For example:

<sqlMap namespace="user">
<resultMap id="User" class="bean.User">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="address" column="id" select="getAddress"/>
</resultMap>

<select id="getUser" parameterClass="int" resultMap="User">
SELECT id,name FROM $schema$.tbl_user WHERE id = #value#
</select>

<select id="getAddress" parameterClass="int" resultClass="string">
SELECT address FROM $schema$.tbl_address WHERE id = #value#
</select>
</sqlMap>

Here, bean.User class has the following properties:
private String schema;

private int id;

private String name;

so, I only passed schema parameter for getUser sql, but I couldn't pass it for getAddress sql.
Please help me to solve this problem. You can contact me by email address: hoanntbkit@yahoo.com
Thank you very much!


Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators