Steve Ebersole commented on New Feature HHH-7635

This is not a valid bi-directional mapping as Hibernate currently models it. The problem is that it is not reflexive. The fulcrum here is the definition of what constitutes the "foreign key" in this association. Currently Hibernate considers is to simply be the customer id column:

... from order o join customer c on o.cust_id = c.id ...

So even if you linked that up in the persisters, both collections are going to get both sets of data.

Instead, you want the "foreign key" to be composite, based on customer id and the order type:

... from order o join customer c on o.cust_id = c.id and o.type = 'SpecialOrder' ...

TBH, I am inclined to call this invalid.

The easiest workaround is to simply move the @ManyToOne private Customer customer definition into each subclass. THere are others, but they get pretty complicated to map.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira