gpt4 book ai didi

java - hibernate 持久性.xml : Disabling contextual LOB creation as connection was null

转载 作者:数据小太阳 更新时间:2023-10-29 02:12:11 26 4
gpt4 key购买 nike

我的persistence.xml:

<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.ibm.apiscanner.DTO.BaselineDTO</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.ibm.db2.jcc.DB2Driver" />
<property name="hibernate.connection.url" value="jdbc:db2://localhost:{PORT}/{DB}" />
<property name="hibernate.connection.username" value="{user}" />
<property name="hibernate.connection.password" value="{password}" />
<property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/>
<property name="show_sql" value="true"/>
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
</properties>
</persistence-unit>
</persistence>

我看到了以下内容:

Jan 22, 2015 9:16:48 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.DB2Dialect
Jan 22, 2015 9:16:48 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null

相同的 url、用户和密码组合在通过基本 JDBC 连接时有效。

有人有建议吗?

最佳答案

这是一条 INFO 消息(无需担心),因为您设置了:

<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>

默认情况下,如果您不指定此属性,它将被设置为 true,并且将使用 JDBC 连接来检查数据库元数据。

所以你有两个选择:

  1. 您删除该属性
  2. 你保留它,但你也添加了这个属性:

    hibernate.jdbc.lob.non_contextual_creation=true

    但随后您会收到一些其他信息消息,告诉您:

    HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true

关于java - hibernate 持久性.xml : Disabling contextual LOB creation as connection was null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28098623/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com