Skip to content

Commit e1fa65a

Browse files
committed
Notes about HibernateJpaVendorAdapter settings vs native Hibernate rules
Issue: SPR-16428
1 parent 4e194c3 commit e1fa65a

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.
@@ -49,6 +49,10 @@ public abstract class AbstractJpaVendorAdapter implements JpaVendorAdapter {
4949
/**
5050
* Specify the target database to operate on, as a value of the {@code Database} enum:
5151
* DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
52+
* <p><b>NOTE:</b> This setting will override your JPA provider's default algorithm.
53+
* Custom vendor properties may still fine-tune the database dialect. However,
54+
* there may nevertheless be conflicts: For example, specify either this setting
55+
* or Hibernate's "hibernate.dialect_resolvers" property, not both.
5256
*/
5357
public void setDatabase(Database database) {
5458
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.
@@ -51,6 +51,14 @@
5151
* along with Spring-driven entity scanning which requires no {@code persistence.xml}
5252
* ({@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setPackagesToScan}).
5353
*
54+
* <p><b>A note about {@code HibernateJpaVendorAdapter} vs native Hibernate settings:</b>
55+
* Some settings on this adapter may conflict with native Hibernate configuration rules
56+
* or custom Hibernate properties. For example, specify either {@link #setDatabase} or
57+
* Hibernate's "hibernate.dialect_resolvers" property, not both. Also, be careful about
58+
* Hibernate's connection release mode: This adapter prefers {@code ON_CLOSE} behavior,
59+
* aligned with {@link HibernateJpaDialect#setPrepareConnection}, at least for non-JTA
60+
* scenarios; you may override this through corresponding native Hibernate properties.
61+
*
5462
* @author Juergen Hoeller
5563
* @author Rod Johnson
5664
* @since 2.0

0 commit comments

Comments
 (0)