随笔分类 - MyBatis
摘要:Configuration conf = new Configuration(); conf.setEnvironment( new Environment.Builder("only") .transactionFactory(new JdbcTransactionFactory()) .data
阅读全文
摘要:jdbc 链接添加 ?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8
阅读全文
摘要:1.批量插入 : insert into student(id,name,classid) values (null,?,?),(null,?,?),(null,?,?)... insert into student(id,name,classid) values ...
阅读全文
摘要:MyBatis的动态SQL是基于OGNL表达式的,它可以帮助我们方便的在SQL语句中实现某些逻辑。MyBatis中用于实现动态SQL的元素主要有:ifchoose(when,otherwise)trimwheresetforeachif就是简单的条件判断,利用if语句我们可以实现某些简单的条件选择。先来看如下一个例子: 这条语句的意思非常简单,如果你提供了title参数,那么就要满足title=#{title},同样如果你提供了Content和Owner的时候,它们也需要满足相应的条件,之后就是返回满足这些条件的所有Blog,这是非常有用的一个功能,以往我们使用其他类型框架或者直接使用J...
阅读全文
摘要:1.Class(班级) 2.Student(学生)
阅读全文
摘要:1.一个结果类public class StudentAndClassesName { private String sName; private String cName; ....}2.Dao中一个函数public interface comboDao { public List find_StudentAndClassesName(); ...}3.Mapper中配置一个查询
阅读全文
摘要:... insert count_t(id, num, str) values (null, #{num}, #{str})
阅读全文
摘要:configuration.xml , MyBatis主配置文件 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...
阅读全文
摘要:update users name=#{name} ,password=#{password} ,age=#{age} where id=#{id} delete from users where id=#{id}...
阅读全文