Question

I'm getting the SQLException "Invalid Column Type" whenever I try to use a parameter in my query. The database field "assessment_id" is of type "NUMBER(15)" in oracle. If I change #{value} to 1 then it works properly and returns my list of Concern objects. However when I try using this parameter, I get the SQL Exception. I'm still not sure what to put for the variable name in the XML, I tried using the same name as the variable I'm passing in.

Here is my mapper config.

<mapper namespace="ConcernMap">
<resultMap id="ConcernResult" type="com.xxx.name.model.Concern" >
    <result column="insCurrent" property="insCurrent"/>
</resultMap>

<select id="fetchConcernsByWorkflowId" parameterType="int" resultMap="ConcernResult">
    SELECT 
    INSURANCE_CURRENT as insCurrent 
    from KOR_CONCERN where assessment_id = #{value}
</select>
</mapper>
Was it helpful?

Solution

Try adding jdbcType=NUMERIC to your query

SELECT 
INSURANCE_CURRENT as insCurrent 
from KOR_CONCERN where assessment_id = #{value,jdbcType=NUMERIC}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top