When utilizing 'Spring Data JPA' the schema is created automatically if you have '@Repository' and '@Entity' annotated classes. Is there any reason why I may want to have the addition of a 'schema.sql' file in the resources folder? There does not seem to have any conflict if you happen to have it present. If so, which takes precedence in creating the structure of the database (tables, columns, etc)? JPA or the 'schema.sql' file when present?
I found an answer according to the link below:
Database Initialization on Spring Boot
" In a JPA-based app, you can choose to let Hibernate create the schema or use schema.sql, but you cannot do both. Make sure to disable spring.jpa.hibernate.ddl-auto if you use schema.sql."
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments