> There are two separate issues:
>
> 1) Hibernate only tries to optimize materializing proxies during
> equals() for the case of reference equality, which is really not all
> that useful.
> 2) It breaks when trying to do so.
You are completely right and that code is absolutely misguided.
I have
> From: Gavin King [mailto:[EMAIL PROTECTED]
>
> > But if the
> > entity doesn't override equals, everything gets wacky because
equals()
> > is not reflexive:
> >
> > proxyA.equals(realA) != realA.equals(proxyA)
>
> In the current implementation, it can only break if we have the same
> object tw
> But if the
> entity doesn't override equals, everything gets wacky because equals()
> is not reflexive:
>
> proxyA.equals(realA) != realA.equals(proxyA)
In the current implementation, it can only break if we have the same
object twice, once as a proxy, and once as a direct reference. This _is_
ppy to submit a patch for it.
Jeff Schnitzer
[EMAIL PROTECTED]
> -Original Message-
> From: Jeff Schnitzer [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 22, 2003 1:18 AM
> To: [EMAIL PROTECTED]
> Subject: [Hibernate] Proxy equals() and hashCode() problem
>
> I just
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 entit