问题描述
我正在学习mybatis。我可以使用 if 条件如下所示:
// num is a property of employee
@Inset({
"<script>","<if test = 'num == null'>","INSERT into version values('333','REOPEN',3)","</if>","<if test = 'num != null'>","INSERT into version values(#{num},"</script>"
})
void save(Employee e);
@Insert({
"<script>","WITH (select * from version where id = #{num}) as a","<if test = 'a == null'>","insert into employee (num,id,name) values (#{num},#{key},#val})","</script>"
})
void insert(Employee e);
这给出了以下运行时错误
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'a' in 'class com.theopendle.demo.domain.Employee'
at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:421) ~[mybatis-3.4.4.jar:3.4.4]
我尝试使用 IF NOT EXISTS 子句,但会出现编译时错误。
我正在尝试查找表中的值,如果该值不存在,那么我是否想插入新行。
我正在使用 Oracle 数据库。请帮忙。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)