JPA/ORM Entities equals() and hashCode()...

JPA/ORM Entities equals() and hashCode() method must use the same fields.

Is this rule useful?
1 votesVote for this rule!

  • Sharebar

Equals and HashCode method should use exactly the same fields. This error is a difficult bug to investigate through entities.

Code example

Suggested refactoring

Rule parameters

Parameter name Value type Default value Description
entityAnnotations StringList javax.persistence.Entity, Entity no description available

Technical details

Technical details
Property Value
Scertify Identifier HbEntityEqualsAndHashCodeUseDifferentFields
Since version 1.9.34
Type of rule VIOLATION
Default criticity BLOCKER
Time analysis cost FAST
False positives presence ? without!

Related links : :

Tags: , , , , , , , , , , , , , , , , , , ,
Available within Scertify™

Leave a Comment

Run the Code Refactory
Scertify™ Professional is an Eclipse plugin dedicated to analyze, control and correction of code quality defects, through computer-assisted code refactoring. It includes +1,600 coding rule controls and several rules for automated-refactoring).

Who we are?

Tocea provides Development Teams with innovative solutions enabling them to continuously control and improve the quality and integrity of their applications. We support developers, architects and project managers in their permanent effort to tackle IT debt and costs, by providing them with unique information on Code & Architecture Quality and some exclusive computer-aided refactoring features.
Visit Tocea.com

LoadingRetrieving latest tweet...

Back to Top

2014 © All rights reserved, Tocea