In our application, it is frequently necessary to form Sets of EJB local interface objects in stateless session bean methods. For example, we might obtain two collections of locals from a pair of entity-bean finder methods, and wish to merge them eliminating duplicates before iterating over the resulting set and performing some operation on each.
This seems to work in JBoss 3.x, and until yesterday we thought it *should* work; it makes sense for local-interface.equals() to perform a reference-equality test, after all. And, of course, having locals define equals() and hashCode() so as to support reference-equality is essential to locals behaving properly in hash-backed collections like HashSet and HashMap. Yesterday, one of the team here spotted the following text in the EJB 2.0 spec, section 9.8: "The result of comparing two object references using the Java programming language Object.equals(Object obj) method is unspecified. Performing the Object.hashCode() method on two object references that represent the entity object is not guaranteed to yield the same result. Therefore, a client should always use the isIdentical method to determine if two entity object references refer to the same entity object." This seems to indicate that hash-backed collections of local object references are not guaranteed to behave properly. If this is the case, is there any safe workaround? Or am I misunderstanding the semantics of locals in hash-backed collections? -- Craig Berry Principal Architect and Technical Manager PortBlue (310) 566-7546 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user