Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Action to set unitName attribute on @PersistenceContext to 'default' #400

Closed
fabapp2 opened this issue Sep 18, 2022 · 0 comments · Fixed by #401
Closed

Add Action to set unitName attribute on @PersistenceContext to 'default' #400

fabapp2 opened this issue Sep 18, 2022 · 0 comments · Fixed by #401
Labels
type: enhancement New feature or request
Milestone

Comments

@fabapp2
Copy link
Contributor

fabapp2 commented Sep 18, 2022

What needs to be done

Add an Action to migrate-jpa-to-spring-boot.yaml to change explicitly set unitName attributes in PersistenceContext annotations (on member level) to 'default' if the value is not default.

Why it needs to be done

Recipe migrate-jpa-to-spring-boot.yaml does not touch unitName of @PersistenceContext but this recipe expects only one persistence-unit to exist with name 'default'. When a different unitName is set the Spring Boot application fails to start.

Acceptance Criteria

Given:

import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
public class Foo {
    @PersistenceContext(unitName = "foo")
    private EntityManager entityManager;
}

Expected:

import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
public class Foo {
    @PersistenceContext(unitName = "default")
    private EntityManager entityManager;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
1 participant