I'm using PostgreSQL 10, Java 11, STS 4, and am attempting to build a Spring Boot 2 application. In Django and Rails, there are tools that allow you to auto-generate SQL scripts after you have constructed your models. Does the same exist for Java/Spring? I created this application.properties file
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=create
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://${PG_DB_HOST:localhost}:5432/${PG_DB_NAME}
spring.datasource.username=${PG_DB_USER}
spring.datasource.password=${PG_DB_PASS}
flyway.url = jdbc:postgresql://${PG_DB_HOST:localhost}:5432/${PG_DB_NAME}
flyway.schemas = ${PG_DB_NAME}
flyway.user = ${PG_DB_USER}
flyway.password = ${PG_DB_PASS}
and I have this Java entity ...
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "Occasions")
public class Occasion {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private UUID id;
@Column(name="name")
private String name;
}
but I'm unclear how or if it is possible to auto-generate SQL scripts using my entity, or if I have to write them myself. Any information is appreciated.