Skip to content

Commit f187ca6

Browse files
committed
Notes about HibernateJpaVendorAdapter settings vs native Hibernate rules
Issue: SPR-16428 (cherry picked from commit e1fa65a)
1 parent 13c2134 commit f187ca6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/AbstractJpaVendorAdapter.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -47,6 +47,10 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
4747
/**
4848
* Specify the target database to operate on, as a value of the {@code Database} enum:
4949
* DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
50+
* <p><b>NOTE:</b> This setting will override your JPA provider's default algorithm.
51+
* Custom vendor properties may still fine-tune the database dialect. However,
52+
* there may nevertheless be conflicts: For example, specify either this setting
53+
* or Hibernate's "hibernate.dialect_resolvers" property, not both.
5054
*/
5155
public void setDatabase(Database database) {
5256
this.database = database;

spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,6 +54,14 @@
5454
* we're exposing the correct, non-deprecated variant depending on the Hibernate
5555
* version encountered at runtime, in order to avoid deprecation log entries.
5656
*
57+
* <p><b>A note about {@code HibernateJpaVendorAdapter} vs native Hibernate settings:</b>
58+
* Some settings on this adapter may conflict with native Hibernate configuration rules
59+
* or custom Hibernate properties. For example, specify either {@link #setDatabase} or
60+
* Hibernate's "hibernate.dialect_resolvers" property, not both. Also, be careful about
61+
* Hibernate's connection release mode: This adapter prefers {@code ON_CLOSE} behavior,
62+
* aligned with {@link HibernateJpaDialect#setPrepareConnection}, at least for non-JTA
63+
* scenarios; you may override this through corresponding native Hibernate properties.
64+
*
5765
* @author Juergen Hoeller
5866
* @author Rod Johnson
5967
* @since 2.0

0 commit comments

Comments
 (0)