Title | [WARN] HHH10001002: Using built-in connection pool (not intended for production use) [WARN] HHH10001002: Using built-in connection pool (not intended for production use) | ||||||
Writer | 이지섭 | Write Date | Aug 5 2024 | Modify Date | Nov 8 2024 | View Count | 1641 |
Hibernate in Spring Boot
If you do not explicitly use an externally provided connection pool,
it will use the built-in connection pool.
In this case
[WARN] HHH10001002: Using built-in connection pool (not intended for production use)
will be displayed.
In this case, you can refer to the documentation on docs.jboss.org from the URLs referenced below.
Use an externally provided connection pool for your production environment.
There are several connection pools available.
The Hikari Pool settings are described below.
And c3p0 is described in the documentation on howtodoinjava.com below.
You can open the reference URL below.
Below is the hibernate.cfg.xml file with the configuration information of the c3p0 connection pool.
Maven dependency settings. <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> <version>6.6.1.Final</version> </dependency> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-hikaricp</artifactId> <version>6.6.1.Final</version> </dependency> <dependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-c3p0</artifactId> <version>6.0.0.Final</version> </dependency>
This is the contents of the hibernate.cfg.xml file. (Hikari pool) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.connection.provider_class">org.hibernate.hikaricp.internal.HikariCPConnectionProvider</property> <property name="hibernate.hikari.driverClassName">com.mysql.cj.jdbc.Driver</property> <property name="hibernate.hikari.jdbcUrl">jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=false</property> <property name="hibernate.hikari.username">user1</property> <property name="hibernate.hikari.password">pass1</property> <property name="hibernate.hikari.minimumIdle">5</property> <property name="hibernate.hikari.maximumPoolSize">10</property> <property name="hibernate.hikari.idleTimeout">30000</property> <property name="hibernate.hikari.leakDetectionThreshold">60000</property> </session-factory> </hibernate-configuration>
This is the contents of the hibernate.cfg.xml file. (c3p0 pool) <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test?autoReconnect=true&useSSL=false</property> <property name="hibernate.connection.username">test</property> <property name="hibernate.connection.password">1234</property> <property name="hibernate.connection.pool_size">10</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="hibernate.c3p0.min_size">10</property> <property name="hibernate.c3p0.max_size">20</property> <property name="hibernate.c3p0.acquire_increment">1</property> <property name="hibernate.c3p0.idle_test_period">3000</property> <property name="hibernate.c3p0.max_statements">50</property> <property name="hibernate.c3p0.timeout">1800</property> <property name="hibernate.c3p0.validate">1800</property> <property name="hibernate.c3p0.unreturnedConnectionTimeout">30</property> <property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property> </session-factory> </hibernate-configuration>
Referenced web pages
| |||||||