Error in Inheritance Mapping with @ManyToOne relations in concrete classes

Description

Given an abstract class with single table inheritance

and some concrete implementations

and another entity that joins those comments polymorphic

a query on activities fails with an entity not found exception. Hibernate 4.3.x inner joins the first commendable (From BulletinComment) in a query that ends in " where comment0_.id=32782 and comment0_.commentable_type in ('News', 'Page')" " but the given id is a PageComment.

The example works in Hibernate 4.2.x. It also works in Hibernate 4.3 if i remove the optional flag in the ManyToOne relations but to me, those associations are not optional and i see no reason to remove it.

And ideas or arguments why i should made them optional with hibernate 4.3? This actually not my only example.

Thanks for looking!

Environment

None

Assignee

Unassigned

Reporter

Michael Simons

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical
Configure