I'm a newbie to Hibernate and JPA and am hoping that some of you with more experience can help me out with some unexpected behavior that I've been seeing in Hibernate.
I'm using a table-per-subclass inheritance strategy in which a subset of my subclasses share a duplicate property name. I didn't want to pull this property into the base class, since it is not an attribute of all of the subclasses. What's confusing me is, when Hibernate generates the polymorphic HQL with this specific property in the where clause, the where condition is always joining on the first subclass that it comes to that contains that property, rather than against the subclass of the actual instance. If I rename the property to force it to be unique, then the query works as expected.
Has anyone else seen this behavior before? Short of giving the property a unique name in each of the entities, I'm not sure how else to handle this. I'll rename the property if I have to, but it just doesn't seem like it should be necessary if Hibernate is handling the polymorphic associations correctly.
I would greatly appreciate any feedback you have!
Thanks!
|