批量插入

在jdbc连接字符串加上 rewriteBatchedStatements=true 可以避免返回所有的自增主键,提升效率

官方描述

rewriteBatchedStatements

Should the driver use multiqueries (regardless of the setting of “allowMultiQueries”) as well as rewriting of prepared statements for INSERT into multi-value inserts when executeBatch() is called? Notice that this has the potential for SQL injection if using plain java.sql.Statements and your code doesn’t sanitize input correctly. Notice that for prepared statements, server-side prepared statements can not currently take advantage of this rewrite option, and that if you don’t specify stream lengths when using PreparedStatement.set*Stream(), the driver won’t be able to determine the optimum number of parameters per batch and you might receive an error from the driver that the resultant packet is too large. Statement.getGeneratedKeys() for these rewritten statements only works when the entire batch includes INSERT statements. Please be aware using rewriteBatchedStatements=true with INSERT .. ON DUPLICATE KEY UPDATE that for rewritten statement server returns only one value as sum of all affected (or found) rows in batch and it isn’t possible to map it correctly to initial statements; in this case driver returns 0 as a result of each batch statement if total count was 0, and the Statement.SUCCESS_NO_INFO as a result of each batch statement if total count was > 0.

Default: false Since version: 3.1.13

使用utf8mb4编码保存表情

仅仅把字段字符设置为utf8mb4是不行的,还需要让orm框架执行 init sql:set names utf8mb4

jfinal:druidPlugin.setConnectionInitSql(“set names utf8mb4”);