When an entity (such as Customer) has a @OneToMany relationship with a specific entity subclass of an entity where the owning relationship field is defined, Hibernate does not find the appropriate property on the superclass.
This or a similar bug was reported before but was closed as WONTFIX without explanation. We encountered this bug after refactoring our code to support differing metadata on different order types, and this seems like a clear case of the sort of field that should be placed on the supertype (though unfortunately the 2.0 spec doesn't address the issue at all).
4.2.0 snapshot for 2012-09-19
Unless and until this feature is implemented, I suggest making the error message for this particular case more specific.
I disagree that this is situation is always a result of bad data model design. Please see my attachment.
This seems to be a popular topic. Already ANN-390, ANN-558, HHH-4233, ANN-615....
What struck me today is the inconsistency between @OneToOne(mappedBy) and @OneToMany(mappedBy). With Order and SpecialOrder as in the example above (I'm using SINGLE_TABLE @Inheritance for Order):
Why can I reference parent class property in @OneToOne-mappedBy and have the discriminator added to SQL but I cannot do the same on @OneToMany-mappedBy?
I'm curious about workaround. If we change AccessType to PROPERTY and override getter in the child class will it work?