christian wrote:
But, for gods sake, please: Stop blaming Hibernate, stop blaming us, stop being mad at everyone else, just because you have a problem with Java identity/equality for the first time. I know that it sucks bad. Even without Hibernate.
I don't blame. I'm just not sure I agree with your claims. I don't know what about the writing here gives the impression that I'm mad. I'm not.
I see this as an issue with trade-offs (due to persistence be it Hibernate or another scheme) and I'm trying to work through which might be the best options given some strong constraints. Looking at the summary table on 109.html led me to believe that only "business-key" based eq/hc works for all 4 use cases. From that I notice that for us there isn't always such a field (we've got domain objects not value objects). So the next step was to say: let's add a field. Well, what types of values should it have? UUID seems fine. Heck any locally unique value is fine. Indeed the pk from the table would be fine. So then comes the choice: change all our PKs to UUID.hex .... or add UUID (or similar) to all our objects?
It's true I thought I could ignore this, but lots of bugs have cropped up with Collections and uniqueness and ordering (List) and concurrency and ... I'm wondering who's tried what that works.