Hi.

I am using iBATIS for mapping java objects to a DB2 database and a
PostgreSQL-Database.

My sqlMap looks like this:

<sqlMap namespace="namespace1">

        <typeAlias alias="vo" type="org.company.PropertyType_VO"/>

        <resultMap id="map" class="vo">
                <result property="instanceId" column="instance"/>
                <result property="value" column="column1"/> 
        </resultMap>

        <sql id="where">
                where instance=#instanceId#
        </sql>

        <select id="select" resultMap="map" resultClass="vo"
parameterClass="vo">
                select #instanceId# as instance, column1 from schema.table1
<include refid="where"/>
        </select>
        
</sqlMap>

The sqlmap generates an sql-statement which should look like this.

        Select 12345 as instance, column1 from schema.table1 where
instance=12345

Using the PostgreSQL-Database the mapping is OK an i get the right data from
the database.

Using the DB2-database it throws the following exception:

Exception in thread "main"
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in org/company/ibatis/sql/db2/prop1.xml.  
--- The error occurred while applying a parameter map.  
--- Check the namespace1.select-InlineParameterMap.  
--- Check the parameter mapping for the 'instanceId' property.  

Is it not possible in iBATIS and DB2 to use the same inline-Parameter in one
statement?

Hope you can help me.

steffen

Reply via email to