Skip to content

Configure Kotlin's all-open plugin for JPA entities #1572

Closed as not planned
Closed as not planned
@YangSiJun528

Description

@YangSiJun528

When creating a project with Kotlin and Spring Data JPA via Spring Initializr, the plugin.spring and plugin.jpa plugins are provided in build.gradle.kts or build.gradle.
However, despite these plugins, the all-open configuration for JPA entities is not included by default. (The same goes for using Maven. There are differences in plugins, but all-open for JPA Entites is not supported.)

Since Kotlin classes are final by default, developers must manually add the all-open configuration for JPA entities on top of the settings provided by Spring Initializr.
Otherwise, eager loading occurs, even when relationships between entities are explicitly marked as lazy. This behavior can be confusing to developers.

This concern was raised earlier in this issue, but it was closed with the suggestion to raise it with the Kotlin team. Unfortunately, the issue (KT-28594) has remained unresolved for nearly six years. As discussed in this pull request, the Kotlin team no longer provides framework-specific solutions for this.

To improve the developer experience, it would be beneficial to include a plugin that provides all-open configuration for JPA entities or automatically adds this configuration.

I’m interested in contributing to this feature and would appreciate any guidance on how to proceed with the implementation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions