Hello,
I’m encountering a severe issue when using the combination of createCriteriaInsertSelect
and onConflict
in Hibernate. In my project, when constructing an INSERT…SELECT query with onConflict
enabled, I get a StackOverflowError
during execution. The stack trace indicates that the error originates from an infinite recursive call (e.g., in methods such as SqmInsertSelectStatement.copy()
and SqmConflictClause.copy()
).
I have verified that this issue is reproducible on all versions from Hibernate 6.5.3.Final and above—including Hibernate 6.6.x and even Hibernate 7.0.0Beta.
A brief overview of my setup is as follows:
- I’m using Spring Boot (with the Spring Boot BOM, e.g.,
spring-boot-dependencies:3.4.3
), where the defaulthibernate-core
version is 6.5.3.Final. - The query is constructed using the Criteria API (
createCriteriaInsertSelect
) and thenonConflict()
is called to handle duplicate key scenarios.
This seems to be a bug within Hibernate’s handling of these APIs, and I’m looking for any insights, workarounds, or updates regarding this behavior. Has anyone else encountered this issue or have a recommended solution? Any information regarding a fix in an upcoming release would be greatly appreciated.
Thank you for your assistance.