TYPE() selector with update generates wrong SQL (on mysql)

Description

I first thought its a Spring Data issue but I was wrong. (see https://jira.spring.io/browse/DATAJPA-1146)

I have an entity hierarchy with single table inheritance. Base Class is "Carrier.java". The table is called "carrierjpa". The failing method tries to update a property but only for a special subtype.

This fails and generates a wrong a sql like

So I think carrier0_ must be omitted here or added after carrierjpa

Environment

None

Activity

Show:
Chris Cranford
July 19, 2017, 1:03 PM

The 4.2 branch is no longer being actively maintained and therefore it'd be helpful if you could see if the problem continues to persist on 5.x.

Markus Lutum
July 19, 2017, 8:22 PM

I found it in our older Jboss 7.1.x application were we can not update the Hibernate Version.
So I just created a Spring Boot app with our class hierarchy to test this with other versions:

Tested it with:
Spring Boot 1.3.5.RELEASE --> Hibernate 4.3.11
Spring Boot 1.5.4.RELEASE --> Hibernate 5.0.12
Spring Boot 2.0.0.M2 ---> Hibernate 5.2.11

It fails on all version with the message:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'carrier0_.ctype' in 'where clause'

So it seams the issue exists also in newer versions...

Chris Cranford
July 20, 2017, 4:44 PM

thanks for checking, that will be super helpful.

Assignee

Unassigned

Reporter

Markus Lutum

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure