H6: Problem with order insert to table with batch is ON


Maybe it’s a bug?

There are two entities:

public class Interpretation {


    @OneToOne(fetch = FetchType.LAZY)
            @JoinColumn(name = "uuid", referencedColumnName = "interpretation_uuid", insertable = false, updatable = false),
            @JoinColumn(name = "interpretation_version", referencedColumnName = "interpretation_version", insertable = false, updatable = false)
    public InterpretationData interpretationData;
public class InterpretationData {
    public InterpretationVersion interpretationVersion;
public class InterpretationVersion implements Serializable {
    @Column(name = "interpretation_version", nullable = false, updatable = false)
    public Long version;
    @Column(name = "interpretation_uuid", nullable = false, updatable = false)
    public UUID uuid;

And when settings have the parametr - hibernate.jdbc.batch_size 1000
then when creating entity Interpretation an error:

InterpretationData interpretationData = new InterpretationData();
interpretation.interpretationData = interpretationData;

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement [Referential integrity constraint violation: "FKAKEPPN0JX5JN1DHRHG8KFINI0: PUBLIC.INTERPRETATIONS FOREIGN KEY(INTERPRETATION_VERSION, UUID) REFERENCES PUBLIC.INTERPRETATION_DATA(INTERPRETATION_VERSION, INTERPRETATION_UUID) (CAST(111 AS BIGINT), UUID 'd76ffb49-2948-4bb0-8320-add1606443b2')";

Apparently for some reason he is trying to first create an Interpretation entity, but should InterpretationData.

I have a test case but I can’t find how to apply it here.

Maybe it’s a bug, yeah. Please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(hibernate-test-case-templates/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

Done! https://hibernate.atlassian.net/browse/HHH-16319
Thank you.