Merge pull request #2992 from vitallan/BAEL-1319
BAEL-1319 Quick Guide on Data.sql and Schema.sql Files in Spring
This commit is contained in:
commit
996bee2732
|
@ -0,0 +1,33 @@
|
|||
package org.baeldung.sqlfiles;
|
||||
|
||||
import static javax.persistence.GenerationType.IDENTITY;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Country {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
INSERT INTO country (name) VALUES ('India');
|
||||
INSERT INTO country (name) VALUES ('Brazil');
|
||||
INSERT INTO country (name) VALUES ('USA');
|
||||
INSERT INTO country (name) VALUES ('Italy');
|
||||
COMMIT;
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE country (
|
||||
id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
|
@ -0,0 +1 @@
|
|||
spring.jpa.hibernate.ddl-auto=none
|
Loading…
Reference in New Issue