[
https://issues.jboss.org/browse/EJBTHREE-319?page=com.atlassian.jira.plug...
]
Carlo de Wolf resolved EJBTHREE-319.
------------------------------------
Resolution: Out of Date
This issue is reported against a version which is no longer maintained,
which means that it will not receive a fix. As a result we are closing
this bug.
If you can reproduce this bug against a currently maintained version of
JBoss EJB 3 please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.
hashCode and equals method definitions are ignored in Session beans
-------------------------------------------------------------------
Key: EJBTHREE-319
URL:
https://issues.jboss.org/browse/EJBTHREE-319
Project: EJB 3.0
Issue Type: Bug
Affects Versions: EJB 3.0 RC3
Environment: Mac OS X 10.4, JBoss AP 4.0.3
Reporter: Gregory Nolle
An equals or hashCode method in a Session bean class is ignored for the final bean
objects. There seems to be some internal implementation of these two methods and it cannot
be overrided.
For example:
Test.java
========
public interface Test { }
TestBean.java
============
@Stateless
public class TestBean implements Test
{
public boolean equals(Object obj) {
return true;
}
public int hashCode() {
return 5;
}
}
Client code
==========
InitialContext ctx = new InitialContext();
Test test = (Test) ctx.lookup(Test.class.getName());
if (!test.equals("anything"))
System.err.println("this is wrong");
if (test.hashCode() != 5)
System.err.println("this is also wrong");
Both of those error messages are printed, when in fact neither should be printed since
the equals() method should always return true in this case, and the result of hashCode()
should always be 5.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira