Home > Back-end >  Spring boot oracle doesn't excute data.sql on startup
Spring boot oracle doesn't excute data.sql on startup

Time:08-04

I have setup oracle as a database, I'm connected to it and can do CRUD operations using spring boot, however, the data.sql file in the resources folder doesn't seem to get excuted

spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto=none
spring.jpa.generate-ddl=false
spring.datasource.initialization-mode=always

this is my jpa properties, and this is my jpa dependency

    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-jdbc</artifactId>
        </exclusion>
    </exclusions>

CodePudding user response:

You have to add

spring.sql.init.mode=always

Here's a guide to this topic: https://www.baeldung.com/spring-boot-data-sql-and-schema-sql

  • Related