Java-mybatis-一次执行多条SQL语句

java

mysql数据库

1、修改数据库连接参数加上allowMultiQueries=true,如:

hikariConfig.security.jdbcUrl=jdbc:mysql://xx.xx.xx:3306/xxxxx?characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true

2、直接写多条语句,用“;”隔开即可

<delete >

    delete from user_role where id=#{id};

    delete from user where userId=#{id};
</delete>

1、修改数据库连接参数加上allowMultiQueries=true,如:

hikariConfig.security.jdbcUrl=jdbc:mysql://xx.xx.xx:3306/xxxxx?characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true

2、直接写多条语句,用“;”隔开即可

<delete >

    delete from user_role where id=#{id};

    delete from user where userId=#{id};
</delete>

以上是 Java-mybatis-一次执行多条SQL语句 的全部内容, 来源链接: utcz.com/z/394672.html

回到顶部