I am trying the functionality like saveOrUpdate with MyBatis, but I am getting the exception while deployment. Below is the query
@Select("<script>"
+ "<foreach item='item' index='index' collection='machineList'>"
+ "<select id='count' resultType='int'>"
+ "Select count(*) from nc_macine_data where (machine_id=#{item.machineId} and machine_name=#{item.machineName} and mchine_value=#{item.machineValue})"
+ "</select>"
+ "<if test='count > 0'>" +
" UPDATE nc_macine_data set mchine_value=#{item.machineValue} where (machine_id=#{item.machineId} and machine_name=#{item.machineName}"
+ "</if>"
+ "<if test='count==0'>"
+ " INSERT INTO nc_macine_data (machine_id, machine_name, mchine_value) values (#{element.machineId}, #{element.machineName}, #{element.machineValue})"
+ "</if>"
+ "</foreach>"
+ "</script>")
Error:
Caused by: org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Unknown element <select> in SQL statement.
What I am missing here?