Bugs item #595738, was opened at 2002-08-15 23:17 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=595738&group_id=22866
Category: JBossServer Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 5 Submitted By: Michael Lipp (mlipp) Assigned to: Nobody/Anonymous (nobody) Summary: Failure if EntityBean overrides equals Initial Comment: Trying to port our project from JBoss 2.2.4 to 3.0.1 I found a problem with EntityBeans that override equals. Our EntityBeans are derived from domain classes that are used in other contexts as well. We consider the EntityBeans as a derivation that adds persistence and remote access. Due to this modelling concept, the domain classes implement equals and hashCode. I scanned through the EJB specification again just now and found nothing that forbids overriding equals/hashCode for an EntityBean. However, it makes JBoss 3.0 fail, because the CachedConnectionManager uses the EntityBean objects as keys in a HashMap. Shouldn't this work with the overridden methods? Not necessarily. The main reason are the EntityBeans created for the finder methods. They have no identity yet and thus get some dummy id. This id is not unique and makes the retrieval of the connection associated with the EntityBean fail (objectToConnectionManagerMap.get(key), with key being the EntityBean). I might work around this and it may even work if JBoss allocates only one EntityBean container for a specific bean (i.e. never have two EntityBean objects with the same primary key) and one for the finder methods. But the general problem remains: the assumption made by JBoss that the EntityBean (i.e. the container object for some persistent data) derives its identity simply from the Java object (as do Object.equals and Object.hashCode) may not be made. No specification prohibits an equals method that returns true for EntityBeans with different primary keys! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=595738&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
