Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 453183 - Entity Classes Do Not Implement equals() and hashCode()
Summary: Entity Classes Do Not Implement equals() and hashCode()
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Customer Support Portal
Classification: Retired
Component: Web-General
Version: 1.3.9
Hardware: All
OS: All
high
high
Target Milestone: ---
: ---
Assignee: Nathan Lugert
QA Contact: David Spalding
URL:
Whiteboard:
: 453182 454733 (view as bug list)
Depends On:
Blocks: HibernateIssues
TreeView+ depends on / blocked
 
Reported: 2008-06-27 18:35 UTC by John Sanda
Modified: 2015-01-20 00:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-05 18:34:41 UTC
Type: ---


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.