Hibernate 5.0.11不记录绑定值

时间:2017-02-11 01:24:10

标签: spring hibernate wildfly

我已经尝试过本网站和其他网站上提供的所有解决方案,但我无法记录hibernate绑定值。

环境:

Spring 4
Hibernate 5.0.11
Wildfly 10.1.0

在standalone.xml中记录配置

        <logger category="org.hibernate">
            <level name="INFO"/>
        </logger>
        <logger category="org.hibernate.type">
            <level name="TRACE"/>
        </logger>
        <logger category="net.sf.hibernate.type">
            <level name="DEBUG"/>
        </logger>
        <logger category="org.hibernate.SQL">
            <level name="DEBUG"/>
        </logger>
        <logger category="org.hibernate.hql">
            <level name="DEBUG"/>
        </logger>
        <root-logger>
            <level name="INFO"/>
            <handlers>
                <handler name="CONSOLE"/>
                <handler name="FILE"/>
            </handlers>
        </root-logger>

Hibernate属性如下所示:

    hibernateProperties.setProperty("hibernate.show-sql","true");
    hibernateProperties.setProperty("hibernate.format_sql","true");
    hibernateProperties.setProperty("hibernate.use_sql_comments","true");

我可以看到查询和评论很好但没有绑定参数和值。

1 个答案:

答案 0 :(得分:3)

应该是org.hibernate.type类别。我使用了以下CLI命令并运行了似乎有效的kitchensink quick start

/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level, value=TRACE)
/subsystem=logging/logger=org.hibernate.type:add(level=TRACE)
/subsystem=logging/logger=org.hibernate.SQL:add(level=DEBUG)

这是我得到的输出。

20:10:52,000 DEBUG [org.hibernate.SQL] (default task-9) call next value for hibernate_sequence
20:10:52,034 DEBUG [org.hibernate.SQL] (default task-9) insert into Member (email, name, phone_number, id) values (?, ?, ?, ?)
20:10:52,036 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (default task-9) binding parameter [1] as [VARCHAR] - [test@example.com]
20:10:52,037 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (default task-9) binding parameter [2] as [VARCHAR] - [Test User]
20:10:52,037 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (default task-9) binding parameter [3] as [VARCHAR] - [5555555555]
20:10:52,037 TRACE [org.hibernate.type.descriptor.sql.BasicBinder] (default task-9) binding parameter [4] as [BIGINT] - [1]

binding parameter [1] as [VARCHAR] - [test@example.com]消息是您正在寻找的消息。