Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove @EqualsAndHashCode annotation for JPA entities #651

Open
iadgovuser59 opened this issue Dec 14, 2023 · 0 comments
Open

Remove @EqualsAndHashCode annotation for JPA entities #651

iadgovuser59 opened this issue Dec 14, 2023 · 0 comments
Labels
migration Update to RHEL 8

Comments

@iadgovuser59
Copy link
Collaborator

Some JPA entities currently use the Project Lombok @EqualsAndHashCode annotation to auto-generate equals() and hashCode() overrides respectively. However, there are some pitfalls in doing so, some of which were encountered during unit test conversion.

It would seem that some Java community discussions (example, among others) recommend manually overriding equals() and hashCode() so as to make behavior more predictable when comparing objects or using JPA lifecycle management. Based on this, it may be possible to run into these issues once two entities are compared, leading to unexpected behavior.

This ticket is to investigate whether removal of these annotations from JPA entities in HIRS is necessary, and if so, to remove them and replace them with equals() and hashCode() implementations as found in master. Afterwards, we may need to copy over the corresponding portions of unit tests from master for these methods to ensure consistency.

@iadgovuser59 iadgovuser59 added the migration Update to RHEL 8 label Dec 14, 2023
@iadgovuser59 iadgovuser59 added this to the Rocky 8 Migration milestone Dec 14, 2023
cyrus-dev added a commit that referenced this issue Dec 22, 2023
In addition, this and the following pushes will have changes for #651
because spot bugs doesn't like how Lombok handles hashCode and equals
@iadgovuser26 iadgovuser26 removed this from the Rocky 8 Migration milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration Update to RHEL 8
Projects
None yet
Development

No branches or pull requests

2 participants