public class RegisterService {
public static final RegisterService me = new RegisterService();
@Before(Tx.class)
public boolean save(){
Record account = new Record();
account.set("username", "test1");
account.set("password", "test1");
account.set("register_ip", "127.0.0.1");
Db.use("1").save("t_account", account);
Record bind = new Record();
bind.set("account","test1");
bind.set("openid","123456");
Db.use("1").save("t_bind", bind);
return true;
}
}第二张表我做了account字段做了唯一索引,第一次执行两张表另插入一条数据,第二次执行到bind表时候数据库会有一个异常,但是第一张表的数据并没有回滚,这是什么原因呢。
PS:项目使用了多个数据源这里的use("1")是存在的