update connection pooling docs
This commit is contained in:
parent
617359f1b6
commit
4fc4151bc8
|
@ -186,23 +186,19 @@ dependencies {
|
|||
// the GOAT ORM
|
||||
implementation 'org.hibernate.orm:hibernate-core:{fullVersion}'
|
||||
|
||||
// Hibernate Processor
|
||||
annotationProcessor 'org.hibernate.orm:hibernate-processor:{fullVersion}'
|
||||
|
||||
// Hibernate Validator
|
||||
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
|
||||
implementation 'org.glassfish:jakarta.el:4.0.2'
|
||||
|
||||
// Agroal connection pool
|
||||
implementation 'org.hibernate.orm:hibernate-agroal:{fullVersion}'
|
||||
implementation 'io.agroal:agroal-pool:2.1'
|
||||
runtimeOnly 'org.hibernate.orm:hibernate-agroal:{fullVersion}'
|
||||
runtimeOnly 'io.agroal:agroal-pool:2.5'
|
||||
|
||||
// logging via Log4j
|
||||
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
|
||||
|
||||
// Hibernate Processor
|
||||
annotationProcessor 'org.hibernate.orm:hibernate-processor:{fullVersion}'
|
||||
|
||||
// Compile-time checking for HQL
|
||||
//implementation 'org.hibernate:query-validator:2.0-SNAPSHOT'
|
||||
//annotationProcessor 'org.hibernate:query-validator:2.0-SNAPSHOT'
|
||||
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.24.1'
|
||||
|
||||
// H2 database
|
||||
runtimeOnly 'com.h2database:h2:2.3.232'
|
||||
|
@ -281,8 +277,8 @@ public class Main {
|
|||
// use H2 in-memory database
|
||||
.jdbcUrl("jdbc:h2:mem:db1")
|
||||
.jdbcCredentials("sa", "")
|
||||
// use Agroal connection pool
|
||||
.property("hibernate.agroal.maxSize", 20)
|
||||
// set the Agroal connection pool size
|
||||
.jdbcPoolSize(16)
|
||||
// display SQL in console
|
||||
.showSql(true, true, true)
|
||||
.createEntityManagerFactory();
|
||||
|
|
|
@ -35,7 +35,9 @@ the connection pool.
|
|||
The connection pool built in to Hibernate is suitable for testing, but isn't intended for use in production.
|
||||
Instead, Hibernate supports several different connection pools, including our favorite, Agroal.
|
||||
|
||||
To select and configure Agroal, you'll need to set some extra configuration properties, in addition to the settings we already saw in <<basic-configuration-settings>>.
|
||||
Hibernate will automatically make use of `AgroalConnectionProvider` if the module `org.hibernate.orm:hibernate-agroal` is available at runtime.
|
||||
|
||||
To properly configure Agroal, you'll need to set some extra configuration properties, in addition to the settings we already saw in <<basic-configuration-settings>>.
|
||||
Properties with the prefix `hibernate.agroal` are passed through to Agroal:
|
||||
|
||||
[source,properties]
|
||||
|
@ -47,7 +49,6 @@ hibernate.agroal.acquisitionTimeout PT1s
|
|||
hibernate.agroal.reapTimeout PT10s
|
||||
----
|
||||
|
||||
As long as you set at least one property with the prefix `hibernate.agroal`, the `AgroalConnectionProvider` will be selected automatically.
|
||||
There are many to choose from, as enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/AgroalSettings.html[`AgroalSettings`]:
|
||||
|
||||
.Settings for configuring Agroal
|
||||
|
@ -78,7 +79,7 @@ The following settings are common to all connection pools supported by Hibernate
|
|||
|===
|
||||
|
||||
A popular alternative to Agroal is HikariCP.
|
||||
Its setting are enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/HikariCPSettings.html[`HikariCPSettings`].
|
||||
Its settings are enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/HikariCPSettings.html[`HikariCPSettings`].
|
||||
|
||||
.Container-managed datasources
|
||||
****
|
||||
|
|
Loading…
Reference in New Issue