Reputation: 23301
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>
Upvotes: 3
Views: 9403
Reputation: 1839
I was having a similar error but using the @Results annotation.
Turns out Mybatis doesn't play nice with Lombok's @Builder and was wrongly identifying the types of the properties of my bean.
Removing the @Builder annotation from the bean solved this issue.
Upvotes: 0
Reputation: 36767
Try adding jdbcType=NUMERIC
to your query
SELECT
INSURANCE_CURRENT as insCurrent
from KOR_CONCERN where assessment_id = #{value,jdbcType=NUMERIC}
Upvotes: 6