A problem has been introduced since hibernate 5.1.3 whereby entities with InheritanceType.SINGLE_TABLE and SecondaryTable are not being saved properly any more. Some classes exist only in the top table, others use additional tables for specific attributes, so we are combining Single and Joined table inheritance, using SecondaryTable for the join.
We are using spring-data-jpa version 1.11.1.release.
In our application we have a base SHAPE table and sub tables that store specific attributes for some other shape types
such as circles. In the case of a circle the table is SHAPE_CIRCLE and it contains the circle centre.
The shapes are wrapped further into a top level class which is used to save a collection of shapes in one go.
An outline of the entities is as follows:
When TopLevel is saved, if a ShapePolygonEntity is in the list before a ShapeCircleEntity then inserts into the SHAPE table
are executed for the polygon but inserts are not generated in the SHAPE and SHAPE_CIRCLE table for the circle.
If the ShapeCircleEntity goes before the ShapePolygonEntity then inserts
are generated in the SHAPE table for the polygon and inserts are generated in the SHAPE and SHAPE_CIRCLE table for the circle.
This used to work either way in version 5.1.3.