Skip to content

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

@fabapp2

Description

@fabapp2

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions