A problem has been introduced since hibernate 5.1.3 where entities with InheritanceType.SINGLE_TABLE and SecondaryTable not being saved properly any more. This was partially fixed in 5.2.11 as a result of bug fix
HHH-11714 Closed . An example test project demonstrating the problem is attached. In our application we have a base SHAPE table and sub tables that store specific attributes for some other shape types such as points, polygons and circles. In the case of a circle the table is SHAPE_CIRCLE and it contains the circle centre. The shapes are wrapped in a “GeographicArea” class. A “TopLevelEntity” class contains a list of “GeographicArea”s. The “GeographicArea” class contains a list of “NestedGeographicArea” which also wraps a shape. (Note that the use of the NestedGeographicArea was not described in bug
HHH-11714 Closed ). So we have a TopLevelEntity that contains many GeographicAreas (containing 1 shape) which contains many NestedGeographicAreas (containing 1 shape). When saving the TopLevelEntity if the GeographicArea and NestedGeographicArea both contain a point shape then a data integrity violation occurs because the shape is not being written before the GeographicArea. If one of the shapes is changed to another type then there is no problem. This is similar to the issue raised in
HHH-11714 Closed . The difference is that the GeographicArea contains a list of NestedGeographicAreas. |