Skip to main content
added 10 characters in body
Source Link
catch32
  • 18.8k
  • 45
  • 153
  • 228

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

Also, found that for PostgreSQL additional step is needed:

@Entity @Table(name = "\"tblEmployees\"") public class Employee { @Id @Column(name = "\"empID\"") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 2, max = 25) @Column(name = "\"empName\"", length = 25) private String name; 

Otherwise, the namenames at DB will be in lowercase, like tblemployees.

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

Also, found that for PostgreSQL additional step is needed:

@Entity @Table(name = "\"tblEmployees\"") public class Employee { @Id @Column(name = "\"empID\"") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 2, max = 25) @Column(name = "\"empName\"", length = 25) private String name; 

Otherwise, the name at DB will be lowercase tblemployees.

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

Also, found that for PostgreSQL additional step is needed:

@Entity @Table(name = "\"tblEmployees\"") public class Employee { @Id @Column(name = "\"empID\"") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 2, max = 25) @Column(name = "\"empName\"", length = 25) private String name; 

Otherwise, the names at DB will be in lowercase, like tblemployees.

added 453 characters in body
Source Link
catch32
  • 18.8k
  • 45
  • 153
  • 228

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

Also, found that for PostgreSQL additional step is needed:

@Entity @Table(name = "\"tblEmployees\"") public class Employee { @Id @Column(name = "\"empID\"") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 2, max = 25) @Column(name = "\"empName\"", length = 25) private String name; 

Otherwise, the name at DB will be lowercase tblemployees.

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

Also, found that for PostgreSQL additional step is needed:

@Entity @Table(name = "\"tblEmployees\"") public class Employee { @Id @Column(name = "\"empID\"") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 2, max = 25) @Column(name = "\"empName\"", length = 25) private String name; 

Otherwise, the name at DB will be lowercase tblemployees.

added 1 character in body
Source Link
catch32
  • 18.8k
  • 45
  • 153
  • 228

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 

For Spring Boot 2 (checked with 2.2.6.RELEASE) it should be configuration yml file:

spring: jpa: hibernate: naming: physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 

So you could have model like:

@Table(name = "tblDepartments") public class Department { @Id @Column(name = "dpID") @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @NotEmpty @Size(min = 1, max = 25) @Column(name = "dpName", length = 25) private String name; 

and populate tables at startup with data.sql:

INSERT INTO tblDepartments (dpName) VALUES ('Gryffindor'); INSERT INTO tblDepartments (dpName) VALUES ('Hufflepuff'); 
Source Link
catch32
  • 18.8k
  • 45
  • 153
  • 228
Loading