Skip to content

fix: add missing @Id annotation to Problem record - #133

Open
HunarBhatia wants to merge 1 commit into
hardikxk:masterfrom
HunarBhatia:fix/problem-record-missing-id
Open

fix: add missing @Id annotation to Problem record#133
HunarBhatia wants to merge 1 commit into
hardikxk:masterfrom
HunarBhatia:fix/problem-record-missing-id

Conversation

@HunarBhatia

Copy link
Copy Markdown

Fixes #130

Problem

The Problem record was missing the @Id annotation on its id field. Without @Id, Spring Data has no way to identify the primary key field, which can cause silent failures in repository operations like findById() and unexpected query behaviour.

Compare with UserProblem which correctly uses @Id:

// UserProblem.java — correct
public record UserProblem(@Id Integer id, ...)

// Problem.java — was missing @Id
public record Problem(int id, ...)

Fix

Added @Id annotation from org.springframework.data.annotation.Id to the id field of the Problem record, consistent with UserProblem.

File Changed

  • problems-service/src/main/java/com/hardik/problemsservice/model/Problem.java

Fixes hardikxk#130

- Problem record was missing @id on the id field
- Without @id Spring Data cannot identify the primary key
- UserProblem correctly uses @id but Problem was inconsistent
@HunarBhatia

Copy link
Copy Markdown
Author

@hardikxk Could you please add labels like bug, backend, and gssoc:approved with a difficulty level so this counts towards GSSoC '26 points? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Problem record missing @Id annotation — Spring Data cannot identify primary key field

1 participant