Skip to content

Commit 4fc4151

Browse files
committed
update connection pooling docs
1 parent 617359f commit 4fc4151

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

documentation/src/main/asciidoc/introduction/Introduction.adoc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,19 @@ dependencies {
186186
// the GOAT ORM
187187
implementation 'org.hibernate.orm:hibernate-core:{fullVersion}'
188188
189+
// Hibernate Processor
190+
annotationProcessor 'org.hibernate.orm:hibernate-processor:{fullVersion}'
191+
189192
// Hibernate Validator
190193
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
191194
implementation 'org.glassfish:jakarta.el:4.0.2'
192195
193196
// Agroal connection pool
194-
implementation 'org.hibernate.orm:hibernate-agroal:{fullVersion}'
195-
implementation 'io.agroal:agroal-pool:2.1'
197+
runtimeOnly 'org.hibernate.orm:hibernate-agroal:{fullVersion}'
198+
runtimeOnly 'io.agroal:agroal-pool:2.5'
196199
197200
// logging via Log4j
198-
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
199-
200-
// Hibernate Processor
201-
annotationProcessor 'org.hibernate.orm:hibernate-processor:{fullVersion}'
202-
203-
// Compile-time checking for HQL
204-
//implementation 'org.hibernate:query-validator:2.0-SNAPSHOT'
205-
//annotationProcessor 'org.hibernate:query-validator:2.0-SNAPSHOT'
201+
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.24.1'
206202
207203
// H2 database
208204
runtimeOnly 'com.h2database:h2:2.3.232'
@@ -281,8 +277,8 @@ public class Main {
281277
// use H2 in-memory database
282278
.jdbcUrl("jdbc:h2:mem:db1")
283279
.jdbcCredentials("sa", "")
284-
// use Agroal connection pool
285-
.property("hibernate.agroal.maxSize", 20)
280+
// set the Agroal connection pool size
281+
.jdbcPoolSize(16)
286282
// display SQL in console
287283
.showSql(true, true, true)
288284
.createEntityManagerFactory();

documentation/src/main/asciidoc/introduction/Tuning.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ the connection pool.
3535
The connection pool built in to Hibernate is suitable for testing, but isn't intended for use in production.
3636
Instead, Hibernate supports several different connection pools, including our favorite, Agroal.
3737

38-
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>>.
38+
Hibernate will automatically make use of `AgroalConnectionProvider` if the module `org.hibernate.orm:hibernate-agroal` is available at runtime.
39+
40+
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>>.
3941
Properties with the prefix `hibernate.agroal` are passed through to Agroal:
4042

4143
[source,properties]
@@ -47,7 +49,6 @@ hibernate.agroal.acquisitionTimeout PT1s
4749
hibernate.agroal.reapTimeout PT10s
4850
----
4951

50-
As long as you set at least one property with the prefix `hibernate.agroal`, the `AgroalConnectionProvider` will be selected automatically.
5152
There are many to choose from, as enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/AgroalSettings.html[`AgroalSettings`]:
5253

5354
.Settings for configuring Agroal
@@ -78,7 +79,7 @@ The following settings are common to all connection pools supported by Hibernate
7879
|===
7980

8081
A popular alternative to Agroal is HikariCP.
81-
Its setting are enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/HikariCPSettings.html[`HikariCPSettings`].
82+
Its settings are enumerated by link:{doc-javadoc-url}/org/hibernate/cfg/HikariCPSettings.html[`HikariCPSettings`].
8283

8384
.Container-managed datasources
8485
****

0 commit comments

Comments
 (0)