BigWiz
BigWiz
JCHJava Community | Help. Code. Learn.
Created by BigWiz on 10/22/2024 in #java-help
Help regarding auto seeding of db tables from the auto generated schema
Have a spring boot application where i am using Spring Data JPA and creating the db schema automatically using the ORM. Now my requirement is to automatically run the schema .sql file to create tables and relationships when building and deploying the project the project . Need some help. Here is my application config:
spring.application.name=RentalNoticeSystem

# Datasource configuration
spring.datasource.url=jdbc:mariadb://localhost:3306/rentalnotice
spring.datasource.username=root
spring.datasource.password=1234qwer

#spring.datasource.username=noticepro
#spring.datasource.password=1234qwer

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

# JPA configuration
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.javax.persistence.database-product=MariaDB
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect

#Hibernate Logging
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE


# Generate the schema DDL to a file (Schema Auto-Generation)
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=generated-schema.sql
spring.jpa.properties.javax.persistence.schema-generation.scripts.drop-target=generated-drop.sql


#Server Context Path for Embedded Tomcat / Jboss External tomcat will not fetch this, it will fetch from WEB-INF/jboss-web.xml
# server.servlet.context-path=/noticepro

#Custom Error Page
server.error.whitelabel.enabled=false
server.error.include-message=always
server.error.include-stacktrace=always

# Custom error path
server.error.path=/error
spring.application.name=RentalNoticeSystem

# Datasource configuration
spring.datasource.url=jdbc:mariadb://localhost:3306/rentalnotice
spring.datasource.username=root
spring.datasource.password=1234qwer

#spring.datasource.username=noticepro
#spring.datasource.password=1234qwer

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

# JPA configuration
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.javax.persistence.database-product=MariaDB
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect

#Hibernate Logging
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE


# Generate the schema DDL to a file (Schema Auto-Generation)
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=generated-schema.sql
spring.jpa.properties.javax.persistence.schema-generation.scripts.drop-target=generated-drop.sql


#Server Context Path for Embedded Tomcat / Jboss External tomcat will not fetch this, it will fetch from WEB-INF/jboss-web.xml
# server.servlet.context-path=/noticepro

#Custom Error Page
server.error.whitelabel.enabled=false
server.error.include-message=always
server.error.include-stacktrace=always

# Custom error path
server.error.path=/error
8 replies