forked from spring-projects/spring-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to Hibernate 5.1, whilst still retaining compatibility with Hibernate 4.3. This commit introduces the following changes: * Add SpringPhysicalNamingStrategy to provides lowercase/underscore table names support. This should be equivalent to the previous SpringNamingStrategy that was used with Hibernate 4. No ImplicitNamingStrategy is provided since the Hibernate 5 defaults appear to be roughly equivalent to the conventions used in Spring Boot 1.3 spring.jpa.hibernate.naming. * Migrate `spring.jpa.hibernate.naming-strategy` to `spring.jpa.hibernate.naming.strategy` and provide additional properties for physical and implicit. * Add `spring.jpa.hibernate.use-new-id-generator-mappings` property and default to `false` when on Hibernate 5 to retain back compatibility. See spring-projectsgh-2763
- Loading branch information
Showing
12 changed files
with
596 additions
and
24 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...figure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2012-2016 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.boot.autoconfigure.orm.jpa; | ||
|
||
import org.springframework.util.ClassUtils; | ||
|
||
/** | ||
* Supported Hibernate versions. | ||
* | ||
* @author Phillip Webb | ||
*/ | ||
enum HibernateVersion { | ||
|
||
/** | ||
* Version 4. | ||
*/ | ||
V4, | ||
|
||
/** | ||
* Version 5. | ||
*/ | ||
V5; | ||
|
||
private static final String HIBERNATE_5_CLASS = "org.hibernate.boot.model." | ||
+ "naming.PhysicalNamingStrategy"; | ||
|
||
private static HibernateVersion running; | ||
|
||
public static HibernateVersion getRunning() { | ||
if (running == null) { | ||
setRunning(ClassUtils.isPresent(HIBERNATE_5_CLASS, null) ? V5 : V4); | ||
} | ||
return running; | ||
} | ||
|
||
static void setRunning(HibernateVersion running) { | ||
HibernateVersion.running = running; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...utoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/jpa/city/City.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.