"gavin.king(a)jboss.com" wrote : I'm really happy to see this discussion.
I've been asking for this for a while now, so its good to see it might actually
happen.
|
i'm squeezing it in for 3.2 cause this changes the DB schema. so you should see it
shortly.
"gavin.king(a)jboss.com" wrote : Tom is totally wrong to suggest that this is a
limitation of JPA/Hibernate (he needs to read Hibernate in Action where this is discussed
carefully). You simply can't use a surrogate key for equals(), it can't possibly
work, and it doesn't make sense anyway from a user point of view.
|
in HIA, i read
"The scope of object identity",
"Outside the identity scope",
"Implementing equals() and hashCode()",
"Using database identifier equality",
"Comparing by value" and
"Using a business key"
again.
In "Implementing equals() and hashCode()" this section explains best what i want
to do:
"... Nevertheless, it's possible to build a complex application with identity
(default) equals as long as you exercise discipline when dealing with detached objects
from different session (and keep an eye on serialization and deserialization)."
very well possible that i am totally wrong. but I still think that hibernate could
provide a better helper method to support that kind of equals and hashcode, but takes the
proxies into account. wouldn't such a helper method make sense ?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022947#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...