Commit bc1ee76b authored by Madhura Bhave's avatar Madhura Bhave

Change default for new_generator_mappings to true

Closes gh-7612
parent 1ad318d8
...@@ -202,7 +202,7 @@ public class JpaProperties { ...@@ -202,7 +202,7 @@ public class JpaProperties {
this.useNewIdGeneratorMappings.toString()); this.useNewIdGeneratorMappings.toString());
} }
else if (!result.containsKey(USE_NEW_ID_GENERATOR_MAPPINGS)) { else if (!result.containsKey(USE_NEW_ID_GENERATOR_MAPPINGS)) {
result.put(USE_NEW_ID_GENERATOR_MAPPINGS, "false"); result.put(USE_NEW_ID_GENERATOR_MAPPINGS, "true");
} }
} }
......
...@@ -108,17 +108,17 @@ public class JpaPropertiesTests { ...@@ -108,17 +108,17 @@ public class JpaPropertiesTests {
Map<String, String> hibernateProperties = properties Map<String, String> hibernateProperties = properties
.getHibernateProperties(mockStandaloneDataSource()); .getHibernateProperties(mockStandaloneDataSource());
assertThat(hibernateProperties) assertThat(hibernateProperties)
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "false"); .containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
} }
@Test @Test
public void useNewIdGeneratorMappingsTrue() throws Exception { public void useNewIdGeneratorMappingsFalse() throws Exception {
JpaProperties properties = load( JpaProperties properties = load(
"spring.jpa.hibernate.use-new-id-generator-mappings:true"); "spring.jpa.hibernate.use-new-id-generator-mappings:false");
Map<String, String> hibernateProperties = properties Map<String, String> hibernateProperties = properties
.getHibernateProperties(mockStandaloneDataSource()); .getHibernateProperties(mockStandaloneDataSource());
assertThat(hibernateProperties) assertThat(hibernateProperties)
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true"); .containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "false");
} }
@Test @Test
......
...@@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@SpringBootTest @SpringBootTest
// Enable JMX so we can test the MBeans (you can't do this in a properties file) // Enable JMX so we can test the MBeans (you can't do this in a properties file)
@TestPropertySource(properties = { "spring.jmx.enabled:true", @TestPropertySource(properties = { "spring.jmx.enabled:true",
"spring.datasource.jmx-enabled:true" }) "spring.datasource.jmx-enabled:true", "spring.jpa.hibernate.use-new-id-generator-mappings=false" })
@ActiveProfiles("scratch") @ActiveProfiles("scratch")
// Separate profile for web tests to avoid clashing databases // Separate profile for web tests to avoid clashing databases
public class SampleDataJpaApplicationTests { public class SampleDataJpaApplicationTests {
......
...@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -34,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -34,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
public class CityRepositoryIntegrationTests { public class CityRepositoryIntegrationTests {
@Autowired @Autowired
......
...@@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest; ...@@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction; import org.springframework.data.domain.Sort.Direction;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -41,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -41,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
public class HotelRepositoryIntegrationTests { public class HotelRepositoryIntegrationTests {
@Autowired @Autowired
......
...@@ -23,6 +23,7 @@ import org.junit.runner.RunWith; ...@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders;
...@@ -44,6 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -44,6 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
@ActiveProfiles("scratch") @ActiveProfiles("scratch")
// Separate profile for web tests to avoid clashing databases // Separate profile for web tests to avoid clashing databases
public class SampleDataRestApplicationTests { public class SampleDataRestApplicationTests {
......
...@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -36,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -36,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
public class CityRepositoryIntegrationTests { public class CityRepositoryIntegrationTests {
@Autowired @Autowired
......
...@@ -22,12 +22,14 @@ import org.junit.runner.RunWith; ...@@ -22,12 +22,14 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
public class SampleFlywayApplicationTests { public class SampleFlywayApplicationTests {
@Autowired @Autowired
......
...@@ -22,6 +22,7 @@ import org.junit.runner.RunWith; ...@@ -22,6 +22,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
...@@ -40,6 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -40,6 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
@WebAppConfiguration @WebAppConfiguration
public class SampleJpaApplicationTests { public class SampleJpaApplicationTests {
......
...@@ -23,6 +23,7 @@ import sample.jpa.domain.Note; ...@@ -23,6 +23,7 @@ import sample.jpa.domain.Note;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
@Transactional @Transactional
public class JpaNoteRepositoryIntegrationTests { public class JpaNoteRepositoryIntegrationTests {
......
...@@ -23,6 +23,7 @@ import sample.jpa.domain.Tag; ...@@ -23,6 +23,7 @@ import sample.jpa.domain.Tag;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
@Transactional @Transactional
public class JpaTagRepositoryIntegrationTests { public class JpaTagRepositoryIntegrationTests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment