Update samples to use new generator mappings

Closes gh-7612
This commit is contained in:
Madhura Bhave
2017-04-27 18:53:05 -07:00
parent f15cf4b991
commit dc7b3f6d6e
21 changed files with 191 additions and 195 deletions

View File

@@ -19,11 +19,13 @@ package sample.flyway;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
@Entity
public class Person {
@Id
@GeneratedValue
@SequenceGenerator(name="person_generator", sequenceName="person_sequence", allocationSize = 1)
@GeneratedValue(generator = "person_generator")
private Long id;
private String firstName;
private String lastName;

View File

@@ -4,4 +4,6 @@ CREATE TABLE PERSON (
last_name varchar(255) not null
);
create sequence person_sequence start with 1 increment by 1;
insert into PERSON (first_name, last_name) values ('Dave', 'Syer');

View File

@@ -22,14 +22,12 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
public class SampleFlywayApplicationTests {
@Autowired