Issue with hibernate-ddl-auto=update when mapping entity to a view. Error trying to generate foreign key constraint on a view

Description

Lately I have been upgrading a legacy project from hibernate 5.0.12 to 5.4.18.
In it we had entities mapped to a database views. The project is written in Grails but I reproduced the issue in
Spring Boot link: https://github.com/ddpopczyk/hibernate-ddl-auto-issue
I get the following exception

A @Subselect annotation can be used to bypass this but it's problematic due to using Gorm for mappings in the project. I'd prefer not to mix in annotation approach in to the project.

Environment

Java 8, Hibernate 5.4.18, Database MySql 8.0.19.

Assignee

Unassigned

Reporter

Dawid Popczyk

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major
Configure