?? When two ids match, then the two instances match as well.
Sure, I agree. But my id:s don't match. I have two different instances. One A and one B, with two different id:s.
If ids match then the instances match because B is a A. The corollary is that if the id values are different then we know they do not represent the same instance like you mention in your reply. If you adhere to this idea, it follows that you cannot define two different id properties in two subclasses of a persistent hierarchy. There can be only one @Id and it must be on the root entity (ignoring mapped superclasses).
Hibernate applies the same logic on version and discriminator columns when they are present. Steve Ebersole you breathe this much more than me, do you think it's viable to support these mixed hierarchies? I am not sure I've run all the scenarios in my head. I looked in the issue tracker and did not find another request for version on subclasses. At first glance and if there are not conceptual issue, it looks like a lot of work in the loaders, persisters, SQL generator and second level cache logic.
|