Bug 453183

Summary: Entity Classes Do Not Implement equals() and hashCode()
Product: [Retired] JBoss Customer Support Portal Reporter: John Sanda <jsanda>
Component: Web-GeneralAssignee: Nathan Lugert <nlugert>
Status: CLOSED WONTFIX QA Contact: David Spalding <dspaldin>
Severity: high Docs Contact:
Priority: high    
Version: 1.3.9CC: mamburn, nraghava
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-05 18:34:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 453175    

Description John Sanda 2008-06-27 18:35:56 UTC
Description of problem:
Most of our persistent classes (i.e., classes managed by Hibernate) do not
implement equals() and hashCode(). These methods are critical for entity types
as well as as any class in which instances are stored in a Collection.
Documentation on this can be found in the Hibernate reference manual at
http://www.hibernate.org/hib_docs/reference/en/html/persistent-classes.html.
This article on the Hibernate site, http://www.hibernate.org/109.html also
provides some good information. 

This has already resulted in production bugs and really should be addressed
sooner rather than later.

Implementing and testing equals() and hashCode() can be difficult. I have
implemented some test libraries to aide in testing. The class ObjectTestUtils
greatly simplifies the verification effort involved. This class is part of the
jbossnetwork project and resides in the test-utils module.

I have also implemented methods to facilitate implementing equals() and
hashCode(), CustomEqualsBuilder and HashCodeBuilderFactory in particular. These
classes handle some MySQL date issues. See Users.java for an example. It is in
the jbossnetwork project in the issuetracker module. 


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Frank Merenda 2008-08-28 12:55:00 UTC
*** Bug 454733 has been marked as a duplicate of this bug. ***

Comment 2 Nathan Lugert 2008-08-28 19:27:32 UTC
*** Bug 453182 has been marked as a duplicate of this bug. ***

Comment 4 David Spalding 2011-01-05 18:34:41 UTC
Superceded by Avalon. This component is no longer valid.