@OneToMany does not work with @JoinFormula

Description

I think @OneToMany annotation does not work at all with @JoinFormula annotation.

I found some old issue https://hibernate.atlassian.net/browse/HHH-9897, but I'm not sure how to interpret it - that is whether it indeed was never supported, or that the specific case in that issue wasn't supported (i.e. with @JoinColumnsOrFormulas).

Having the following entity:

The above mapping does not work. During validation we get exception

Adding reverse side of the relationship (@ManyToOne with @JoinFormula) and adding "mappedBy" to @OneToMany does not change anything - still same error. Also it does not matter that in the attached example we have relation from table A to the same table A - I tested it with different tables with same result.

Test case: https://github.com/hibernate/hibernate-orm/pull/2547
Started here: https://discourse.hibernate.org/t/how-to-use-the-hibernate-joinformula-annotation-with-a-onetomany-jpa-association/1461

Environment

None

Assignee

Unassigned

Reporter

Dominik Bieliński

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure