我的开发环境
Idea 2019 1.1
Maven3.05
Mysql5.x
我的pom.xml依赖
mysql
mysql-connector-java
5.1.35
org.mybatis
mybatis
3.4.5
log4j
log4j
1.2.12
junit
junit
4.10
test
org.projectlombok
lombok
1.18.8
provided
Mybatis需要的配置文件的信息
mybatisConfig.xml Mybatis的主配置文件 里面封装了Mybatis连接数据库的信息以及DAO的映射文件的信息
jdbcConfig.properties 连接数据库的配置文件
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/ssm
username=root
password=ok
maxActive=100
log4j.properties 日志的配置文件
# Global logging configuration
log4j.rootLogger=ERROR, stdout
# log4j.logger.your DAO package_name log type can write "TRACE" or "DEBUG"
#配置为所有的 dao 也就是增删改查的顶级接口包
log4j.logger.cn.icanci.ssm.dao=TRACE
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
IUserDao.xml UserDao接口对应的映射配置文件
这里就上个图了 都是增删改查的操作 下面的部分我也没有截图
那么现在开始就是注意点了
1.包名对应 建议是必须对应 为什么?
请看图 首先要说的是 java代码全部放在 java目录下 配置文件以及资源文件放在resources下 如果和接口对应的话 配置应该在同一个包下
此处我的接口和我对应的配置文件都在同一个包下 而且名字保持对应一致 当然不保持一致也是可以的 在后面我会继续补充
这样在编译之后 是会把resources的文件全部合并在一起 这里的targe包就是编译之后的字节码文件 同时我的配置文件的 xml文件等也被编译到这个目录下对应的包下
看上图,是一一对应的.
现在看全局配置文件也就是 mybatisConfig.xml文件的内容
之前我并没有配置这个地方 也没有配置别名 所以每次书写 xxxDao.xml 里面的 parameterType 和 resultType 的时候就要写domain的全限定名 很累 通过上图注释的内容
但是为每一个domain都写 这个配置 我还是觉得不方便 既然能偷懒为什么不偷懒 所有全部注释掉 把这个typeAlias 标签注释掉 使用
这样我就操作很简单了 现在来测试一下 对不对 不废话 请看图
测试类
IUserDao.xml文件的对应 sql
对应数据库表
刷新之后
那么这里是成功了的 下面再查询一个全部 测试 通过是可以的
对应的 IUserDao.xml 配置文件
那么继续说下一个位置的配置
数据库的连接配置
数据库的四个属性连接名 相对应
这样就不用写数据库连接的配置了 以后修改只需要修改 jdbc的配置文件就可以
好的,现在 我要说的 命名的坑来了
上面的坑没有埋伏笔 我就直接干了 现在我们需要演示一下报错
我把配置文件的名字进行修改 但是包地址不修改 如下图 我修改了 DAO 的映射 配置
现在我们测试 通不通
现在看是没问题 那么我们继续看
全局 xml 配置里面的 mapper 标签 里面的 package 标签可以配置为接口所在的包 如果使用这个标签 就不用写
那么现在我们来配置一下 如图
现在来测试一下 然后发现 它居然挂了
为什么报错呢,我们再试试另外一个 domain
再看一个 报错依旧是和我刚刚修改的 User 有关 那么我们就发现问题了
为什么呢?那就看看区别 唯一的区别就是名字 所以当你使用 和DAO接口不一致的 配置的 xml 文件名字 再使用 package 就会报错 我太蠢了 找了好久的原因 改回去 测试 通了
这里mybatis对 DAO接口对应的 mapper配置文件做了规定 如果使用 package 标签 那么路径和名字必须保持一致 不然 怎么找得到哪个 xml 配置文件是哪一个 DAO 接口的配置文件呢
继续下一个坑
这里我做的是一个一对一关系映射 居然挂了?
但是我的确有的啊 这个也找了好久的原因
最后找到了原因 javaType 没有写 写了之后就不报错了
本文最后谈一个mybatis的懒加载和立即加载机制
什么是懒加载? 就是需要的时候我再查询你 加载你 不需要就不查询 和java单例设计模式的饿汉式(立即加载)和懒汉式(懒加载)类似 立即加载就是查了必须有 不查完不许停下 相比之下 貌似sql里面的懒加载更好一些,当然是根据业务逻辑来评价滴
废话不说 首先做2个配置
第一个
第二个
这个是啥?来看官网介绍
这里我都做配置
然后开始执行测试代码 不废话 上图
我先贴一下 Account 的domain 还有 IAccountDao.xml 的对应配置
测试 仔细查看代码不同的打印
而我修改打印的内容 出现这么多查询 和结果
这里划重点 第一次我只打印了 Account 里面的money 只查询了 Account 基本的属性 而没查询 User 的内容 但是 第二次 我打印的全部 所以进行了很多次查询 这里就是懒加载
现在我去除懒加载 再进行测试
测试结果 看下图 全部都加载出来了 因为执行了sql 所以二者区别在此 但是最后的应用还是根据需求来修改代码
Mybatis注解的使用
使用Mybatis的注解 就不需要再使用 DAO的映射xml文件
先看两个实体类
User.java
package cn.icanci.ssm.domain;
import lombok.Data;
import java.util.List;
/**
* @author icanci
* @version 1.0
* @date 2019-12-15 16:40
* @website http://icanci.cn/
*/
@Data
public class User {
private Long id;
private String username;
private String password;
private String email;
private List accounts;
private List roles;
}
Account.java
package cn.icanci.ssm.domain;
import lombok.Data;
/**
* @author icanci
* @version 1.0
* @date 2019-12-16 14:34
* @website http://icanci.cn/
*/
@Data
public class Account {
private Long id;
private Long uid;
private Double money;
private User user;
}
这两个类之间有一对多,一对一的联系 也就是 一个User 有多个账户 一个账户却只有一个User 通过字段关联 private List accounts; private User user;
DAO接口 添加注解标签
IUserDao.java
在接口声明的方法上贴Update的标签 用来执行插入操作 Options 用来拿到主键给此User对象
@Update("insert into user (username,password,email) values (#{username},#{password},#{email})")
@Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
因为是一对多 所以下面使用many select 里面是DAO全限定名.方法名 fetchType = FetchType.LAZY配置懒加载
@Result(property = "accounts",column = "id",
many = @Many(select = "cn.icanci.ssm.dao.IAccountDao.findAllByUserId",fetchType = FetchType.LAZY))
package cn.icanci.ssm.dao;
import cn.icanci.ssm.domain.QueryVo;
import cn.icanci.ssm.domain.User;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
/**
* @author icanci
* @version 1.0
* @date 2019-12-15 16:59
* @website http://icanci.cn/
*/
public interface IUserDao {
/**
* 保存一个用户的信息
* @param user 需要保存的用户的对象
*/
@Update("insert into user (username,password,email) values (#{username},#{password},#{email})")
@Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
void save(User user);
/**
* 查询所有的用户数据
* @return 查询得到的list集合
*/
@Select("select id,username,password,email from user")
@Results(id = "userMap",value = {
@Result(id=true, column = "id",property = "id"),
@Result(column = "username",property ="username",javaType = String.class,jdbcType = JdbcType.VARCHAR),
@Result(column = "password",property = "password",javaType = String.class,jdbcType = JdbcType.VARCHAR),
@Result(column = "email",property = "email",javaType = String.class, jdbcType = JdbcType.VARCHAR),
@Result(property = "accounts",column = "id",
many = @Many(select = "cn.icanci.ssm.dao.IAccountDao.findAllByUserId",fetchType = FetchType.LAZY))
}
)
List listAll();
/**
* 根据user 的 id 查询一个user
* @param userId 需要查询的user的id
* @return 返回一个user对象
*/
@Select("select * from user where id = #{userId}")
User findByUserId(Long userId);
}
IAccountDao.java
因为需要根据User 的 id 查询所有Account信息 所以需要一个方法 如下
@Select("select * from account where uid = #{uid}")
List findAllByUserId(Long uid);
一对一代码
@Result(column = "uid",property = "user",
one = @One(select = "cn.icanci.ssm.dao.IUserDao.findByUserId",fetchType = FetchType.EAGER))
package cn.icanci.ssm.dao;
import cn.icanci.ssm.domain.Account;
import cn.icanci.ssm.domain.AccountUser;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author icanci
* @version 1.0
* @date 2019-12-16 14:35
* @website http://icanci.cn/
*/
public interface IAccountDao {
/**
* 查询所有账户
* @return 返回所有账户的 List 集合
*/
List findAll();
/**
* 查询所有账户
* @return 返回所有账户的 List 集合
*/
@Select("select * from account")
@Results(id = "accountMap",value = {
@Result(id = true,column = "id",property="id"),
@Result(column = "uid",property = "uid",javaType = Long.class,jdbcType = JdbcType.BIGINT),
@Result(column = "money",property = "monry",javaType = Double.class,jdbcType = JdbcType.DOUBLE),
@Result(column = "uid",property = "user",one = @One(select = "cn.icanci.ssm.dao.IUserDao.findByUserId",fetchType = FetchType.EAGER))
}
)
List findAll();
/**
* 根据 UserId 查询所有的账户信息
* @param uid 需要查询的用户的id
* @return 返回泛型为 Account 的List集合
*/
@Select("select * from account where uid = #{uid}")
List findAllByUserId(Long uid);
}
UserDaoTest.java
package cn.icanci.ssm.test;
import cn.icanci.ssm.dao.IUserDao;
import cn.icanci.ssm.domain.QueryVo;
import cn.icanci.ssm.domain.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* @author icanci
* @version 1.0
* @date 2019-12-15 17:10
* @website http://icanci.cn/
*/
public class UserDaoTest {
@Test
public void testSave() throws Exception{
Reader reader = Resources.getResourceAsReader("mybatisConfig.xml");
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
SqlSessionFactory factory = builder.build(reader);
SqlSession session = factory.openSession();
IUserDao userDao = session.getMapper(IUserDao.class);
User user = new User();
user.setUsername("icanci1 zj");
user.setPassword("icanci1");
user.setEmail("[email protected]");
System.out.println(user);
userDao.save(user);
//提交事务 如果没有提交事务就不能进行提交到数据库
session.commit();
System.out.println(user);
session.close();
}
@Test
public void testListAll() throws Exception {
Reader reader = Resources.getResourceAsReader("mybatisConfig.xml");
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
SqlSessionFactory factory = builder.build(reader);
SqlSession session = factory.openSession();
IUserDao userDao = session.getMapper(IUserDao.class);
List list = userDao.listAll();
for (User user : list) {
System.out.println(user);
// System.out.println(user.getAccounts());
}
session.close();
}
}
测试代码 输出 同一个对象 id 是执行insert 之后就增加的
User(id=null, username=icanci1 zj, password=icanci1, [email protected], accounts=null, roles=null)
DEBUG [main] - ==> Preparing: insert into user (username,password,email) values (?,?,?)
DEBUG [main] - ==> Parameters: icanci1 zj(String), icanci1(String), [email protected](String)
DEBUG [main] - <== Updates: 1
User(id=16, username=icanci1 zj, password=icanci1, [email protected], accounts=null, roles=null)
Process finished with exit code 0
测试全部查询 根据日志可以看出是执行了 懒加载的
D:\ProgramFiles\Java\jdk1.8.0_131\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\Idea 2019\IntelliJ IDEA 2019.1\lib\idea_rt.jar=57560:D:\Idea 2019\IntelliJ IDEA 2019.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\Idea 2019\IntelliJ IDEA 2019.1\lib\idea_rt.jar;D:\Idea 2019\IntelliJ IDEA 2019.1\plugins\junit\lib\junit-rt.jar;D:\Idea 2019\IntelliJ IDEA 2019.1\plugins\junit\lib\junit5-rt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\charsets.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\deploy.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\javaws.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jce.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jfr.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jsse.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\management-agent.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\plugin.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\resources.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\rt.jar;F:\IdeaWorkplace\maven\ssmm\target\test-classes;F:\IdeaWorkplace\maven\ssmm\target\classes;F:\MaveHome\myIdeaLocalRepository\mysql\mysql-connector-java\5.1.35\mysql-connector-java-5.1.35.jar;F:\MaveHome\myIdeaLocalRepository\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;F:\MaveHome\myIdeaLocalRepository\log4j\log4j\1.2.12\log4j-1.2.12.jar;F:\MaveHome\myIdeaLocalRepository\junit\junit\4.10\junit-4.10.jar;F:\MaveHome\myIdeaLocalRepository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;F:\MaveHome\myIdeaLocalRepository\org\projectlombok\lombok\1.18.8\lombok-1.18.8.jar;F:\MaveHome\myIdeaLocalRepository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;F:\MaveHome\myIdeaLocalRepository\javax\el\javax.el-api\3.0.0\javax.el-api-3.0.0.jar;F:\MaveHome\myIdeaLocalRepository\javax\servlet\jstl\1.2\jstl-1.2.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 cn.icanci.ssm.test.UserDaoTest,testListAll
DEBUG [main] - ==> Preparing: select id,username,password,email from user
DEBUG [main] - ==> Parameters:
TRACE [main] - <== Columns: id, username, password, email
TRACE [main] - <== Row: 7, 11mybatisUptate11111, icanci1, [email protected]
TRACE [main] - <== Row: 8, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 9, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 10, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 13, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 14, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 15, icanci1 zj, icanci1, [email protected]
TRACE [main] - <== Row: 16, icanci1 zj, icanci1, [email protected]
DEBUG [main] - <== Total: 8
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 7(Long)
TRACE [main] - <== Columns: id, uid, money
TRACE [main] - <== Row: 1, 7, 8000
TRACE [main] - <== Row: 3, 7, 4444
DEBUG [main] - <== Total: 2
User(id=7, username=11mybatisUptate11111, password=icanci1, [email protected], accounts=[Account(id=1, uid=7, money=8000.0, user=null), Account(id=3, uid=7, money=4444.0, user=null)], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 8(Long)
TRACE [main] - <== Columns: id, uid, money
TRACE [main] - <== Row: 2, 8, 345346
DEBUG [main] - <== Total: 1
User(id=8, username=icanci1, password=icanci1, [email protected], accounts=[Account(id=2, uid=8, money=345346.0, user=null)], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 9(Long)
DEBUG [main] - <== Total: 0
User(id=9, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 10(Long)
DEBUG [main] - <== Total: 0
User(id=10, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 13(Long)
DEBUG [main] - <== Total: 0
User(id=13, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 14(Long)
DEBUG [main] - <== Total: 0
User(id=14, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 15(Long)
DEBUG [main] - <== Total: 0
User(id=15, username=icanci1 zj, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 16(Long)
DEBUG [main] - <== Total: 0
User(id=16, username=icanci1 zj, password=icanci1, [email protected], accounts=[], roles=null)
Process finished with exit code 0
一对一查询测试 这里使用立即加载 输出日志如下
D:\ProgramFiles\Java\jdk1.8.0_131\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\Idea 2019\IntelliJ IDEA 2019.1\lib\idea_rt.jar=58036:D:\Idea 2019\IntelliJ IDEA 2019.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\Idea 2019\IntelliJ IDEA 2019.1\lib\idea_rt.jar;D:\Idea 2019\IntelliJ IDEA 2019.1\plugins\junit\lib\junit-rt.jar;D:\Idea 2019\IntelliJ IDEA 2019.1\plugins\junit\lib\junit5-rt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\charsets.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\deploy.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\javaws.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jce.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jfr.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\jsse.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\management-agent.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\plugin.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\resources.jar;D:\ProgramFiles\Java\jdk1.8.0_131\jre\lib\rt.jar;F:\IdeaWorkplace\maven\ssmm\target\test-classes;F:\IdeaWorkplace\maven\ssmm\target\classes;F:\MaveHome\myIdeaLocalRepository\mysql\mysql-connector-java\5.1.35\mysql-connector-java-5.1.35.jar;F:\MaveHome\myIdeaLocalRepository\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;F:\MaveHome\myIdeaLocalRepository\log4j\log4j\1.2.12\log4j-1.2.12.jar;F:\MaveHome\myIdeaLocalRepository\junit\junit\4.10\junit-4.10.jar;F:\MaveHome\myIdeaLocalRepository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;F:\MaveHome\myIdeaLocalRepository\org\projectlombok\lombok\1.18.8\lombok-1.18.8.jar;F:\MaveHome\myIdeaLocalRepository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;F:\MaveHome\myIdeaLocalRepository\javax\el\javax.el-api\3.0.0\javax.el-api-3.0.0.jar;F:\MaveHome\myIdeaLocalRepository\javax\servlet\jstl\1.2\jstl-1.2.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 cn.icanci.ssm.test.UserDaoTest,testListAll
DEBUG [main] - ==> Preparing: select id,username,password,email from user
DEBUG [main] - ==> Parameters:
TRACE [main] - <== Columns: id, username, password, email
TRACE [main] - <== Row: 7, 11mybatisUptate11111, icanci1, [email protected]
TRACE [main] - <== Row: 8, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 9, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 10, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 13, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 14, icanci1, icanci1, [email protected]
TRACE [main] - <== Row: 15, icanci1 zj, icanci1, [email protected]
TRACE [main] - <== Row: 16, icanci1 zj, icanci1, [email protected]
DEBUG [main] - <== Total: 8
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 7(Long)
TRACE [main] - <== Columns: id, uid, money
TRACE [main] - <== Row: 1, 7, 8000
TRACE [main] - <== Row: 3, 7, 4444
DEBUG [main] - <== Total: 2
User(id=7, username=11mybatisUptate11111, password=icanci1, [email protected], accounts=[Account(id=1, uid=7, money=8000.0, user=null), Account(id=3, uid=7, money=4444.0, user=null)], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 8(Long)
TRACE [main] - <== Columns: id, uid, money
TRACE [main] - <== Row: 2, 8, 345346
DEBUG [main] - <== Total: 1
User(id=8, username=icanci1, password=icanci1, [email protected], accounts=[Account(id=2, uid=8, money=345346.0, user=null)], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 9(Long)
DEBUG [main] - <== Total: 0
User(id=9, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 10(Long)
DEBUG [main] - <== Total: 0
User(id=10, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 13(Long)
DEBUG [main] - <== Total: 0
User(id=13, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 14(Long)
DEBUG [main] - <== Total: 0
User(id=14, username=icanci1, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 15(Long)
DEBUG [main] - <== Total: 0
User(id=15, username=icanci1 zj, password=icanci1, [email protected], accounts=[], roles=null)
DEBUG [main] - ==> Preparing: select * from account where uid = ?
DEBUG [main] - ==> Parameters: 16(Long)
DEBUG [main] - <== Total: 0
User(id=16, username=icanci1 zj, password=icanci1, [email protected], accounts=[], roles=null)
Process finished with exit code 0