HHH-13214 Delete re-firing SQL from previous calls
This commit is contained in:
parent
0614bfe3b8
commit
0b71131136
|
@ -8,6 +8,7 @@ package org.hibernate.hql.spi.id.inline;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,7 +33,7 @@ public abstract class AbstractInlineIdsDeleteHandlerImpl
|
||||||
extends AbstractInlineIdsBulkIdHandler
|
extends AbstractInlineIdsBulkIdHandler
|
||||||
implements MultiTableBulkIdStrategy.DeleteHandler {
|
implements MultiTableBulkIdStrategy.DeleteHandler {
|
||||||
|
|
||||||
private final List<String> deletes = new ArrayList<>();
|
private List<String> deletes;
|
||||||
|
|
||||||
public AbstractInlineIdsDeleteHandlerImpl(
|
public AbstractInlineIdsDeleteHandlerImpl(
|
||||||
SessionFactoryImplementor factory,
|
SessionFactoryImplementor factory,
|
||||||
|
@ -42,6 +43,9 @@ public abstract class AbstractInlineIdsDeleteHandlerImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getSqlStatements() {
|
public String[] getSqlStatements() {
|
||||||
|
if ( deletes.isEmpty() ) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
return deletes.toArray( new String[deletes.size()] );
|
return deletes.toArray( new String[deletes.size()] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +55,7 @@ public abstract class AbstractInlineIdsDeleteHandlerImpl
|
||||||
QueryParameters queryParameters) {
|
QueryParameters queryParameters) {
|
||||||
|
|
||||||
IdsClauseBuilder values = prepareInlineStatement( session, queryParameters );
|
IdsClauseBuilder values = prepareInlineStatement( session, queryParameters );
|
||||||
|
deletes = new ArrayList<>();
|
||||||
|
|
||||||
if ( !values.getIds().isEmpty() ) {
|
if ( !values.getIds().isEmpty() ) {
|
||||||
final String idSubselect = values.toStatement();
|
final String idSubselect = values.toStatement();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class AbstractInlineIdsUpdateHandlerImpl
|
||||||
extends AbstractInlineIdsBulkIdHandler
|
extends AbstractInlineIdsBulkIdHandler
|
||||||
implements MultiTableBulkIdStrategy.UpdateHandler {
|
implements MultiTableBulkIdStrategy.UpdateHandler {
|
||||||
|
|
||||||
private final Map<Integer, String> updates = new LinkedHashMap<>();
|
private Map<Integer, String> updates;
|
||||||
|
|
||||||
private ParameterSpecification[][] assignmentParameterSpecifications;
|
private ParameterSpecification[][] assignmentParameterSpecifications;
|
||||||
|
|
||||||
|
@ -47,6 +47,9 @@ public abstract class AbstractInlineIdsUpdateHandlerImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getSqlStatements() {
|
public String[] getSqlStatements() {
|
||||||
|
if ( updates == null ) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
return updates.values().toArray( new String[updates.values().size()] );
|
return updates.values().toArray( new String[updates.values().size()] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +59,7 @@ public abstract class AbstractInlineIdsUpdateHandlerImpl
|
||||||
QueryParameters queryParameters) {
|
QueryParameters queryParameters) {
|
||||||
|
|
||||||
IdsClauseBuilder values = prepareInlineStatement( session, queryParameters );
|
IdsClauseBuilder values = prepareInlineStatement( session, queryParameters );
|
||||||
|
updates = new LinkedHashMap<>();
|
||||||
|
|
||||||
if ( !values.getIds().isEmpty() ) {
|
if ( !values.getIds().isEmpty() ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue