SSM项⽬打印执⾏的sql语句
在ssm项⽬中,只需要在l配置中添加⼀个setting即可。
traceroute用法<!-- 打印查询语句 -->
<setting name="logImpl" value="STDOUT_LOGGING" />
下⾯贴⼀下我的整个l配置⽂件,供参考。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-////DTD Config 3.0//EN" "/dtd/mybatis-3-config.dtd">
<configuration>mysql语句的执行顺序
<!-- 配置mybatis的缓存,延迟加载等等⼀系列属性 -->
<settings>
<!-- 全局映射器启⽤缓存 -->
<setting name="cacheEnabled" value="true"/>
<!-- 查询时,关闭关联对象即时加载以提⾼性能 -->
<setting name="lazyLoadingEnabled" value="true"/>
<!-- 对于未知的SQL查询,允许返回不同的结果集以达到通⽤的效果 -->
<setting name="multipleResultSetsEnabled" value="true"/>
<!-- 允许使⽤列标签代替列名 -->
前端框架最重要的是什么<setting name="useColumnLabel" value="true"/>
<!-- 不允许使⽤⾃定义的主键值(⽐如由程序⽣成的UUID 32位编码作为键值),数据表的PK⽣成策略将被覆盖 -->
<setting name="useGeneratedKeys" value="false"/>
<!-- 给予被嵌套的resultMap以字段-属性的映射⽀持 FULL,PARTIAL -->
<setting name="autoMappingBehavior" value="PARTIAL"/>
<!-- Allows using RowBounds on nested statements -->
<setting name="safeRowBoundsEnabled" value="false"/>
<!-- Enables automatic mapping from classic database column names A_COLUMN to camel case classic Java property names aColumn. -->
<setting name="mapUnderscoreToCamelCase" value="true"/>
<!-- MyBatis uses local cache to prevent circular references and speed up repeated nested queries.
By default (SESSION) all queries executed during a s ession are cached. If localCacheScope=STATEMENT
local session will be used just for statement execution, no data will be shared between two different calls to the same SqlSession. -->
<setting name="localCacheScope" value="SESSION"/>
<!-- Specifies the JDBC type for null values when no specific JDBC type was provided for the parameter. Some drivers require specifying the column JDB C type but others work with generic values
like NULL, VARCHAR or OTHER. -->
<setting name="jdbcTypeForNull" value="OTHER"/>
<!-- Specifies which Object's methods trigger a lazy load -->
<!-- Specifies which Object's methods trigger a lazy load -->
<setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
在线随机抽数字软件<!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指定),不会加载关联表的所有字段,以提⾼性能 --> <setting name="aggressiveLazyLoading" value="false"/>
<setting name="logImpl" value="STDOUT_LOGGING"/>
<setting name="logImpl" value="LOG4J"/>
<!-- 打印查询语句 -->
<setting name="logImpl" value="STDOUT_LOGGING" />
</settings>
<typeAliases>
<!-- 注:model表对象配置,请按照 model 包中的顺序进⾏录⼊,并做好注释. -->
</typeAliases>
<plugins>shell编程查看用户代码
<plugin interceptor="com.github.abel533.mapperhelper.MapperInterceptor">
<!--主键⾃增回写⽅法,默认值MYSQL,详细说明请看⽂档 -->
<property name="IDENTITY" value="MYSQL" />
<!--通⽤Mapper接⼝,多个通⽤接⼝⽤逗号隔开 -->
<property name="mappers" value="com.github.abel533.mapper.Mapper" />
</plugin>
使用多线程的好处</plugins>
</configuration>
2019.8.29更新
如果是使⽤Idea操作Mybatis,
这⾥推荐⼀款插件:
可以点进我的另⼀篇博客具体查看⼀下。
使⽤了这款插件之后。就可以打开⼀个单独的窗⼝显⽰完整的sql(不是带占位符的那种)。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论