Skip to content

Commit 75e7770

Browse files
committed
Revert "HHH-19314 StackOverflowException when using onConflict with createCriteriaInsertValues and createCriteriaInsertSelect"
This reverts commit 0d2d2a8.
1 parent bf7a6dd commit 75e7770

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/AbstractSqmInsertStatement.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ protected List<SqmPath<?>> copyInsertionTargetPaths(SqmCopyContext context) {
8989
}
9090
}
9191

92-
void setConflictClause(SqmConflictClause<T> conflictClause) {
93-
this.conflictClause = conflictClause;
94-
}
95-
9692
protected void verifyInsertTypesMatch(
9793
List<SqmPath<?>> insertionTargetPaths,
9894
List<? extends SqmTypedNode<?>> expressions) {

hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmConflictClause.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private SqmConflictClause(
5454
this.insertStatement = insertStatement;
5555
this.excludedRoot = excludedRoot;
5656
this.constraintName = constraintName;
57-
this.constraintPaths = constraintPaths == null ? null : Collections.unmodifiableList( constraintPaths );
57+
this.constraintPaths = Collections.unmodifiableList( constraintPaths );
5858
this.updateAction = updateAction;
5959
}
6060

@@ -157,7 +157,7 @@ public SqmConflictClause<T> copy(SqmCopyContext context) {
157157
insertStatement.copy( context ),
158158
excludedRoot.copy( context ),
159159
constraintName,
160-
constraintPaths == null ? null : copyOf( constraintPaths, context ),
160+
copyOf( constraintPaths, context ),
161161
updateAction == null ? null : updateAction.copy( context )
162162
)
163163
);

hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertSelectStatement.java

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,19 @@ public SqmInsertSelectStatement<T> copy(SqmCopyContext context) {
7777
if ( existing != null ) {
7878
return existing;
7979
}
80-
final SqmInsertSelectStatement<T> sqmInsertSelectStatementCopy = new SqmInsertSelectStatement<>(
81-
nodeBuilder(),
82-
context.getQuerySource() == null ? getQuerySource() : context.getQuerySource(),
83-
copyParameters( context ),
84-
copyCteStatements( context ),
85-
getTarget().copy( context ),
86-
null,
87-
null,
88-
selectQueryPart.copy( context )
80+
return context.registerCopy(
81+
this,
82+
new SqmInsertSelectStatement<>(
83+
nodeBuilder(),
84+
context.getQuerySource() == null ? getQuerySource() : context.getQuerySource(),
85+
copyParameters( context ),
86+
copyCteStatements( context ),
87+
getTarget().copy( context ),
88+
copyInsertionTargetPaths( context ),
89+
getConflictClause() == null ? null : getConflictClause().copy( context ),
90+
selectQueryPart.copy( context )
91+
)
8992
);
90-
91-
context.registerCopy( this, sqmInsertSelectStatementCopy );
92-
93-
sqmInsertSelectStatementCopy.setInsertionTargetPaths( copyInsertionTargetPaths( context ) );
94-
95-
if ( getConflictClause() != null ) {
96-
sqmInsertSelectStatementCopy.setConflictClause( getConflictClause().copy( context ) );
97-
}
98-
99-
return sqmInsertSelectStatementCopy;
10093
}
10194

10295
@Override

hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/SqmInsertValuesStatement.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public SqmInsertValuesStatement<T> copy(SqmCopyContext context) {
8282
valuesList.add( sqmValues.copy( context ) );
8383
}
8484
}
85-
86-
final SqmInsertValuesStatement<T> sqmInsertValuesStatementCopy = context.registerCopy(
85+
return context.registerCopy(
8786
this,
8887
new SqmInsertValuesStatement<>(
8988
nodeBuilder(),
@@ -92,16 +91,10 @@ public SqmInsertValuesStatement<T> copy(SqmCopyContext context) {
9291
copyCteStatements( context ),
9392
getTarget().copy( context ),
9493
copyInsertionTargetPaths( context ),
95-
null,
94+
getConflictClause() == null ? null : getConflictClause().copy( context ),
9695
valuesList
9796
)
9897
);
99-
100-
if ( getConflictClause() != null ) {
101-
sqmInsertValuesStatementCopy.setConflictClause( getConflictClause().copy( context ) );
102-
}
103-
104-
return sqmInsertValuesStatementCopy;
10598
}
10699

107100
public SqmInsertValuesStatement<T> copyWithoutValues(SqmCopyContext context) {

0 commit comments

Comments
 (0)