mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Findbugs fixes
This commit is contained in:
parent
fa1cff82d5
commit
be3b5a09e4
@ -70,11 +70,6 @@ public abstract class AbstractSQLQuery<T extends AbstractSQLQuery<T>> extends Pr
|
||||
|
||||
protected final QueryMixin<T> queryMixin;
|
||||
|
||||
@Nullable
|
||||
protected Expression<?> union;
|
||||
|
||||
protected boolean unionAll;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AbstractSQLQuery(QueryMetadata metadata, Configuration conf, PersistenceManager persistenceManager,
|
||||
boolean detach) {
|
||||
|
||||
@ -44,7 +44,7 @@ public final class JPAUtil {
|
||||
}
|
||||
}
|
||||
if (hasParameters) {
|
||||
Parameter parameter = query.getParameter(Integer.valueOf(key));
|
||||
Parameter parameter = query.getParameter(Integer.parseInt(key));
|
||||
Class parameterType = parameter != null ? parameter.getParameterType() : null;
|
||||
if (parameterType != null && !parameterType.isInstance(val)) {
|
||||
if (val instanceof Number && Number.class.isAssignableFrom(parameterType)) {
|
||||
|
||||
@ -312,7 +312,6 @@ public class SQLInsertClause extends AbstractSQLClause<SQLInsertClause> implemen
|
||||
context = startContext(connection, metadata, entity);
|
||||
try {
|
||||
PreparedStatement stmt = null;
|
||||
Collection<PreparedStatement> stmts = null;
|
||||
if (batches.isEmpty()) {
|
||||
stmt = createStatement(true);
|
||||
listeners.notifyInsert(entity, metadata, columns, values, subQuery);
|
||||
@ -321,18 +320,19 @@ public class SQLInsertClause extends AbstractSQLClause<SQLInsertClause> implemen
|
||||
stmt.executeUpdate();
|
||||
listeners.preExecute(context);
|
||||
} else {
|
||||
stmts = createStatements(true);
|
||||
|
||||
Collection<PreparedStatement> stmts = createStatements(true);
|
||||
if (stmts != null && stmts.size() > 1) {
|
||||
throw new IllegalStateException("executeWithKeys called with batch statement and multiple SQL strings");
|
||||
}
|
||||
stmt = stmts.iterator().next();
|
||||
listeners.notifyInserts(entity, metadata, batches);
|
||||
|
||||
listeners.preExecute(context);
|
||||
stmt.executeBatch();
|
||||
listeners.executed(context);
|
||||
}
|
||||
if (stmts != null && stmts.size() > 1) {
|
||||
throw new IllegalStateException("executeWithKeys called with batch statement and multiple SQL strings");
|
||||
}
|
||||
final Statement stmt2 = stmts != null ? stmts.iterator().next() : stmt;
|
||||
|
||||
final Statement stmt2 = stmt;
|
||||
ResultSet rs = stmt.getGeneratedKeys();
|
||||
return new ResultSetAdapter(rs) {
|
||||
@Override
|
||||
|
||||
@ -205,7 +205,6 @@ public class SQLMergeClause extends AbstractSQLClause<SQLMergeClause> implements
|
||||
try {
|
||||
if (configuration.getTemplates().isNativeMerge()) {
|
||||
PreparedStatement stmt = null;
|
||||
Collection<PreparedStatement> stmts = null;
|
||||
if (batches.isEmpty()) {
|
||||
stmt = createStatement(true);
|
||||
listeners.notifyMerge(entity, metadata, keys, columns, values, subQuery);
|
||||
@ -214,17 +213,19 @@ public class SQLMergeClause extends AbstractSQLClause<SQLMergeClause> implements
|
||||
stmt.executeUpdate();
|
||||
listeners.executed(context);
|
||||
} else {
|
||||
stmts = createStatements(true);
|
||||
Collection<PreparedStatement> stmts = createStatements(true);
|
||||
if (stmts != null && stmts.size() > 1) {
|
||||
throw new IllegalStateException("executeWithKeys called with batch statement and multiple SQL strings");
|
||||
}
|
||||
stmt = stmts.iterator().next();
|
||||
listeners.notifyMerges(entity, metadata, batches);
|
||||
|
||||
listeners.preExecute(context);
|
||||
stmt.executeBatch();
|
||||
listeners.executed(context);
|
||||
}
|
||||
if (stmts != null && stmts.size() > 1) {
|
||||
throw new IllegalStateException("executeWithKeys called with batch statement and multiple SQL strings");
|
||||
}
|
||||
final Statement stmt2 = stmts != null ? stmts.iterator().next() : stmt;
|
||||
|
||||
final Statement stmt2 = stmt;
|
||||
ResultSet rs = stmt.getGeneratedKeys();
|
||||
return new ResultSetAdapter(rs) {
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user