'How to create table automatically based JPA Entity?
I want to create a table in MySQL databases automatically based on the JPA entity annotation naming and configuration as given below.
@Getter
@Setter
@Entity
@Table(name = "Business")
public class BusinessEntity {
@Id
@Column(name = "Id")
private Integer id;
@Column(name = "Name")
private String name;
}
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
With the given configuration, the table is getting created with the expected column name but a table name is always in lowercase but I need to create in the same case as given with @Table annotation.
Please help, Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
