File tree Expand file tree Collapse file tree
java/org/baeldung/sqlfiles Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .baeldung .sqlfiles ;
2+
3+ import static javax .persistence .GenerationType .IDENTITY ;
4+
5+ import javax .persistence .Column ;
6+ import javax .persistence .Entity ;
7+ import javax .persistence .GeneratedValue ;
8+ import javax .persistence .Id ;
9+
10+ @ Entity
11+ public class Country {
12+
13+ @ Id
14+ @ GeneratedValue (strategy = IDENTITY )
15+ private Integer id ;
16+
17+ @ Column (nullable = false )
18+ private String name ;
19+
20+ public Integer getId () {
21+ return id ;
22+ }
23+ public void setId (Integer id ) {
24+ this .id = id ;
25+ }
26+ public String getName () {
27+ return name ;
28+ }
29+ public void setName (String name ) {
30+ this .name = name ;
31+ }
32+
33+ }
Original file line number Diff line number Diff line change 1+ INSERT INTO country (name) VALUES (' India' );
2+ INSERT INTO country (name) VALUES (' Brazil' );
3+ INSERT INTO country (name) VALUES (' USA' );
4+ INSERT INTO country (name) VALUES (' Italy' );
5+ COMMIT ;
Original file line number Diff line number Diff line change 1+ CREATE TABLE country (
2+ id INTEGER NOT NULL AUTO_INCREMENT,
3+ name VARCHAR (128 ) NOT NULL ,
4+ PRIMARY KEY (id)
5+ );
Original file line number Diff line number Diff line change 1+ spring.jpa.hibernate.ddl-auto =none
You can’t perform that action at this time.
0 commit comments