| Christian Ciach, I simplified your test case with the following mapping which triggers exactly the same failure.
@Entity
public class SelfRefEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@OneToOne(cascade = CascadeType.ALL, optional = true)
private SelfRefEntity reference;
}
After discussion with Steve Ebersole, we believe we have an idea on how to deal with this and the other more recently reported use cases. The idea we are floating is provide a mechanism where shouldDelayIdentityInserts will be forced to false to restore legacy behavior for very specific use cases, such as those described in this issue and a few others that have recently been reported. I have a working fix at the moment for both HHH-13042 In Progress (this) and HHH-13044 In Progress that i need to see if it covers HHH-13053 Open . Hopefully either by end of day today or Monday I should have a PR pushed and ready for 5.4 integration after review. |