Update samples to use new generator mappings
Closes gh-7612
This commit is contained in:
@@ -20,15 +20,16 @@ import java.util.List;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
||||
@Entity
|
||||
public class Note {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@SequenceGenerator(name="note_generator", sequenceName="note_sequence", initialValue = 5)
|
||||
@GeneratedValue(generator = "note_generator")
|
||||
private long id;
|
||||
|
||||
private String title;
|
||||
|
||||
@@ -23,12 +23,14 @@ import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
|
||||
@Entity
|
||||
public class Tag {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@SequenceGenerator(name="tag_generator", sequenceName="tag_sequence", initialValue = 4)
|
||||
@GeneratedValue(generator = "tag_generator")
|
||||
private long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
insert into tag(name) values ('Spring projects')
|
||||
insert into tag(name) values ('Apache projects')
|
||||
insert into tag(name) values ('Open source')
|
||||
insert into tag(id, name) values (1, 'Spring projects')
|
||||
insert into tag(id, name) values (2, 'Apache projects')
|
||||
insert into tag(id, name) values (3, 'Open source')
|
||||
|
||||
insert into note(title, body) values ('Spring Boot', 'Takes an opinionated view of building production-ready Spring applications.')
|
||||
insert into note(title, body) values ('Spring Framework', 'Core support for dependency injection, transaction management, web applications, data access, messaging, testing and more.')
|
||||
insert into note(title, body) values ('Spring Integration', 'Extends the Spring programming model to support the well-known Enterprise Integration Patterns.')
|
||||
insert into note(title, body) values ('Tomcat', 'Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies.')
|
||||
insert into note(id, title, body) values (1, 'Spring Boot', 'Takes an opinionated view of building production-ready Spring applications.')
|
||||
insert into note(id, title, body) values (2, 'Spring Framework', 'Core support for dependency injection, transaction management, web applications, data access, messaging, testing and more.')
|
||||
insert into note(id, title, body) values (3, 'Spring Integration', 'Extends the Spring programming model to support the well-known Enterprise Integration Patterns.')
|
||||
insert into note(id, title, body) values (4, 'Tomcat', 'Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies.')
|
||||
|
||||
insert into note_tags(notes_id, tags_id) values (1, 1)
|
||||
insert into note_tags(notes_id, tags_id) values (2, 1)
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.web.WebAppConfiguration;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -41,7 +40,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@WebAppConfiguration
|
||||
public class SampleJpaApplicationTests {
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import sample.jpa.domain.Note;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -36,7 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@Transactional
|
||||
public class JpaNoteRepositoryIntegrationTests {
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import sample.jpa.domain.Tag;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -36,7 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@Transactional
|
||||
public class JpaTagRepositoryIntegrationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user