jakartaee / jakartaee/persistence

Auto generate record ID class if no explicit `@IdClass`

Open
#681 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
268
Forks
78
Avg merge
1d 6h
Merged PRs (30d)
13

Description

Given an entity meets:
1. using composite primary key
2. no `@IdClass` annotated

For example:
```java
@Entity
public class Employee {
@Id String empName;
@Id Date birthDay;
...
}
```
It would be convenient if a record class is generated as implicit `@IdClass`
```java
public record EmployeeId(String empName, Date birthDay) {}
```
candidate names of generated record class:
- EmployeeId
- EmployeePK
- EmployeeId_
- EmployeePK_
- Employee$Id
- Employee$PK

Contributor guide

Open the contributing guide

Research direction

No implementation files, tests, or entry points are named. Start by reviewing the composite-key example and the proposed record-class names, then determine the specification and implementation scope. Done means entities with composite primary keys and no explicit @IdClass receive a consistent implicit record class.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.