Skip to content

Update Person ID type from long to Long #45

@Voodooa

Description

@Voodooa

Hello,

In the guide "[Accessing JPA Data with REST](https://github.com/spring-guides/gs-accessing-data-rest/blob/main/complete/src/main/java/com/example/accessingdatarest/Person.java)," the Person entity uses an ID of type long.

To align this guide with JPA best practices and other Spring examples (where Long is used for IDs), I suggest changing long to Long. This prevents issues related to the default value of long (0, which may be interpreted as a valid ID) and ensures better consistency across examples.


Proposed Fix:

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id; // Change from long to Long

Thank you for considering this update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions