1

While Deployment of my application i got this hibernate warning (twice):

WARN  org.hibernate.orm.connections.pooling - HHH10001002: Using Hibernate built-in connection pool (not for production use!)

I don't want to use either these built-in connection pool from Hibernate, nor any other implementation like C3PO.

I tried a lot of things, but i was not able to use the connection pooling of my Weblogic Application Server.

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>

weblogic.xml:

    ...
    <resource-description>
        <res-ref-name>jdbc/myDS</res-ref-name>
        <jndi-name>myDS</jndi-name>
    </resource-description>
    ...

web.xml:

...
    <resource-ref>
       <res-ref-name>jdbc/myDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
    </resource-ref>
...

PS: I'm getting the Connection via the Entitymanager and i don't have any context.xml.

What can i do? Can anybody help?

ban
  • 23
  • 1
  • 4
  • Does this answer your question? [hibernate connection pool](https://stackoverflow.com/questions/2067526/hibernate-connection-pool) – f1sh Feb 19 '20 at 14:41
  • @f1sh: The configuration of your link above uses the C3PO connection pooling. But this is not want i want, because i want to use weblogic's internal pooling. I did really a lot of research and tried many things but i still get these warning message. – ban Feb 19 '20 at 15:08

1 Answers1

0

You shouldn't be setting the datasource using properties. There is and standard way to provide the datasource to the entity manager, using the <jta-data-source> element.

You only should need something like this:

<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>
areus
  • 2,880
  • 2
  • 7
  • 17