Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 08a56f1

Browse files
committed
Add physical naming stategy to always uppercase and set applicaiton.yml to use
1 parent 7c1631a commit 08a56f1

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.cloud.dataflow.server.repository.support;
17+
18+
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
19+
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
20+
21+
/**
22+
* Override {@code isCaseInsensitive} to always return false
23+
*
24+
* @author Mark Pollack
25+
*/
26+
public class UpperCaseSpringPhysicalNamingStrategy extends SpringPhysicalNamingStrategy {
27+
28+
@Override
29+
protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) {
30+
return false;
31+
}
32+
33+
}

spring-cloud-dataflow-server-core/src/main/resources/META-INF/dataflow-server-defaults.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ spring:
1818
jpa:
1919
properties:
2020
hibernate.id.new_generator_mappings: true
21+
hibernate:
22+
naming:
23+
physical-strategy: org.springframework.cloud.dataflow.server.repository.support.UpperCaseSpringPhysicalNamingStrategy
2124
autoconfigure:
2225
exclude: org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
2326
cloud:

spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/repository/SchemaGenerationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
4040
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
4141
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
42-
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
4342
import org.springframework.boot.test.context.SpringBootTest;
43+
import org.springframework.cloud.dataflow.server.repository.support.UpperCaseSpringPhysicalNamingStrategy;
4444
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
4545
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
4646
import org.springframework.test.context.junit4.SpringRunner;
@@ -95,7 +95,7 @@ private void generateDdlFiles(String dialect, File tempDir, PersistenceUnitInfo
9595
final MetadataSources metadata = new MetadataSources(
9696
new StandardServiceRegistryBuilder()
9797
.applySetting("hibernate.dialect", "org.hibernate.dialect." + dialect + "Dialect")
98-
.applySetting("hibernate.physical_naming_strategy", SpringPhysicalNamingStrategy.class.getName())
98+
.applySetting("hibernate.physical_naming_strategy", UpperCaseSpringPhysicalNamingStrategy.class.getName())
9999
.applySetting("hibernate.implicit_naming_strategy", SpringImplicitNamingStrategy.class.getName())
100100
.build());
101101

0 commit comments

Comments
 (0)