I just looked over the LazyInitializer code to manage equals() and
hashCode() in a proxy and it seems like there's a problem.  I'm trying
to use an entity as a hash map key without requiring it to be initialized,
and the code tries to handle this - except that this behavior is
disabled if the entity overrides equals.  However, won't it be
the case that entities (at least ones used as hashmap keys) are
always going to need to override equals()?  A hashmap on reference
equality is pretty useless.

It seems to me that the only practical convention here is to require that
entity equals() follow identity rules if it's going to be put in a
hash map and use proxies.  Otherwise they always have to be initialized.

FWIW, my specific use case is an entity which contains a map of another
entity to Float.

Jeff Schnitzer
[EMAIL PROTECTED]


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to