Error : Spot bug: Class defines compareTo(…) and uses Object.equals()

This SpotBug is trying to say that you’re not overriding equals in ForeignKeyConstraint (and thus inheriting the equals from Object )

Troubleshooting
To solve this particular error,
You have to add the following code for Equals and Hashcode function in your respective POJO class where you have defined your compareTo() function.

You can do this in the following steps:

  1. Right Click anywhere in the Editor and select the Source Action Option.

  2. The next step after that would be to select the Generate hashCode() and equals() option.

  1. Now you can select all the variables that are declared in this respective POJO and click on OK.

The equals() and hashCode() functions are now generated.