openrewrite / openrewrite/rewrite-spring
2.4-2.5: Hibernate and data.sql
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 403
- Forks
- 149
- Avg merge
- 2h 33m
- Merged PRs (30d)
- 10
Description
blocked-by openrewrite/rewrite/issues/1315
Release Notes
By default, data.sql scripts are now run before Hibernate is initialized. This aligns the behavior of basic script-based initialization with that of Flyway and Liquibase. If you want to use data.sql to populate a schema created by Hibernate, set spring.jpa.defer-datasource-initialization to true. While mixing database initialization technologies is not recommended, this will also allow you to use a schema.sql script to build upon a Hibernate-created schema before it’s populated via data.sql.
- Requires user decision!
- Must be applied after #127
Condition
data.sqlexists in classpath root ORspring.sql.init.data-locationsis set.
Recipe
- Inform the user about the changed initialization order and when to set
spring.jpa.defer-datasource-initializationtotrue
related issues: #134 - beans depending on database initialization might be affected by spring.jpa.defer-datasource-initialization, see https://docs.spring.io/spring-boot/docs/2.5.0/reference/html//howto.html#howto.data-initialization.dependencies.depends-on-initialization-detection
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Spring Boot 2.5 release notes and OpenRewrite issue #1315, then review the implementation for issue #127 and related issue #134. Add the recipe behavior for projects with data.sql or spring.sql.init.data-locations, informing users about the changed order and when to set spring.jpa.defer-datasource-initialization to true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100