Java HHH10001002:使用Hibernate内置连接池(不用于生产!)

Java HHH10001002:使用Hibernate内置连接池(不用于生产!),java,hibernate,jpa,connection-pooling,weblogic12c,Java,Hibernate,Jpa,Connection Pooling,Weblogic12c,在部署应用程序时,我收到以下hibernate警告(两次): 我不想使用这些来自Hibernate的内置连接池,也不想使用任何其他实现,比如C3PO 我尝试了很多方法,但无法使用Weblogic应用程序服务器的连接池 My persistence.xml: <persistence... <persistence-unit name="MY-PERSISTENCE-UNIT"> <description>Hibernate JPA Configuration

在部署应用程序时,我收到以下hibernate警告(两次):

我不想使用这些来自Hibernate的内置连接池,也不想使用任何其他实现,比如C3PO

我尝试了很多方法,但无法使用Weblogic应用程序服务器的连接池

My persistence.xml:

<persistence...
<persistence-unit name="MY-PERSISTENCE-UNIT">
    <description>Hibernate JPA Configuration</description>
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

    <class>some classes...</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <properties>
        <property name="hibernate.connection.datasource" value="jdbc/myDS"/>
        <property name="hibernate.hbm2ddl.auto" value="none"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
        <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="jndi.class" value="weblogic.jndi.WLInitialContextFactory"/>
    </properties>
</persistence-unit>
</persistence>

您不应该使用属性设置数据源。使用
元素向实体管理器提供数据源有两种标准方法

你只需要这样的东西:

<persistence...
<persistence-unit name="MY-PERSISTENCE-UNIT">
    <description>Hibernate JPA Configuration</description>
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

    <jta-data-source>jdbc/myDS</jta-data-source>    

    <class>some classes...</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <properties>
        <property name="hibernate.hbm2ddl.auto" value="none"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
    </properties>
</persistence-unit>
</persistence>

您不应该使用属性设置数据源。使用
元素向实体管理器提供数据源有两种标准方法

你只需要这样的东西:

<persistence...
<persistence-unit name="MY-PERSISTENCE-UNIT">
    <description>Hibernate JPA Configuration</description>
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

    <jta-data-source>jdbc/myDS</jta-data-source>    

    <class>some classes...</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <properties>
        <property name="hibernate.hbm2ddl.auto" value="none"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
    </properties>
</persistence-unit>
</persistence>

这是否回答了您的问题@f1sh:上面链接的配置使用C3PO连接池。但这不是我想要的,因为我想要使用weblogic的内部池。我做了很多研究,尝试了很多东西,但我仍然得到了这些警告信息。这是否回答了你的问题@f1sh:上面链接的配置使用C3PO连接池。但这不是我想要的,因为我想要使用weblogic的内部池。我做了很多研究,尝试了很多东西,但我仍然得到了这些警告信息。
...
    <resource-ref>
       <res-ref-name>jdbc/myDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
    </resource-ref>
...
<persistence...
<persistence-unit name="MY-PERSISTENCE-UNIT">
    <description>Hibernate JPA Configuration</description>
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

    <jta-data-source>jdbc/myDS</jta-data-source>    

    <class>some classes...</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>

    <properties>
        <property name="hibernate.hbm2ddl.auto" value="none"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect"/>
    </properties>
</persistence-unit>
</persistence>