Skip to content

Commit 69776bc

Browse files
committed
cleanup IntelliJ warnings in dialect package
1 parent b571b22 commit 69776bc

30 files changed

+28
-153
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
import org.hibernate.tool.schema.extract.spi.ColumnTypeInformation;
6262
import org.hibernate.type.JavaObjectType;
6363
import org.hibernate.type.descriptor.jdbc.JdbcType;
64-
import org.hibernate.type.descriptor.jdbc.JdbcTypeConstructor;
6564
import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcType;
6665
import org.hibernate.type.descriptor.jdbc.UUIDJdbcType;
6766
import org.hibernate.type.descriptor.jdbc.VarbinaryJdbcType;

hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialectQueryHints.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ String addJoinHint(String query, JoinHint hint) {
8484
StringBuilder buffer = new StringBuilder();
8585
int start = 0;
8686
while ( m.find() ) {
87-
buffer.append( query.substring( start, m.start() ) );
87+
buffer.append(query, start, m.start());
8888

8989
if ( m.group( 1 ) == null ) {
9090
buffer.append( " inner" );

hibernate-core/src/main/java/org/hibernate/dialect/DB2SqlAstTranslator.java

-18
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.hibernate.sql.ast.tree.expression.Expression;
2929
import org.hibernate.sql.ast.tree.expression.Literal;
3030
import org.hibernate.sql.ast.tree.expression.SqlTuple;
31-
import org.hibernate.sql.ast.tree.expression.Summarization;
3231
import org.hibernate.sql.ast.tree.from.NamedTableReference;
3332
import org.hibernate.sql.ast.tree.from.QueryPartTableReference;
3433
import org.hibernate.sql.ast.tree.from.TableGroup;
@@ -558,23 +557,6 @@ protected void renderSelectTupleComparison(
558557
emulateSelectTupleComparison( lhsExpressions, tuple.getExpressions(), operator, true );
559558
}
560559

561-
@Override
562-
protected void renderPartitionItem(Expression expression) {
563-
if ( expression instanceof Literal ) {
564-
appendSql( "()" );
565-
}
566-
else if ( expression instanceof Summarization ) {
567-
Summarization summarization = (Summarization) expression;
568-
appendSql( summarization.getKind().sqlText() );
569-
appendSql( OPEN_PARENTHESIS );
570-
renderCommaSeparated( summarization.getGroupings() );
571-
appendSql( CLOSE_PARENTHESIS );
572-
}
573-
else {
574-
expression.accept( this );
575-
}
576-
}
577-
578560
@Override
579561
protected boolean supportsRowValueConstructorSyntax() {
580562
return false;

hibernate-core/src/main/java/org/hibernate/dialect/DB2StructJdbcType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* To support UDTs, we require that a transform exists for the UDT that serializes from SQL to XML
3232
* and deserializes to SQL from UDT. This means that from the JDBC perspective, this is an XML type,
3333
* but the database models it internally as UDT.
34-
*
34+
* <p>
3535
* The {@link org.hibernate.dialect.aggregate.DB2AggregateSupport} generates the functions and transforms for this
3636
* process automatically, but note that all of this is only used for functions and native queries.
3737
* By default, we select individual struct parts to avoid the encoding/decoding.

hibernate-core/src/main/java/org/hibernate/dialect/DB2iDialect.java

-10
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,6 @@ public boolean supportsSkipLocked() {
131131
return true;
132132
}
133133

134-
@Override
135-
public boolean supportsLateral() {
136-
return true;
137-
}
138-
139-
@Override
140-
public boolean supportsRecursiveCTE() {
141-
return true;
142-
}
143-
144134
@Override
145135
public SqlAstTranslatorFactory getSqlAstTranslatorFactory() {
146136
return new StandardSqlAstTranslatorFactory() {

hibernate-core/src/main/java/org/hibernate/dialect/DB2zDialect.java

-10
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,6 @@ public boolean supportsSkipLocked() {
143143
return true;
144144
}
145145

146-
@Override
147-
public boolean supportsLateral() {
148-
return true;
149-
}
150-
151-
@Override
152-
public boolean supportsRecursiveCTE() {
153-
return true;
154-
}
155-
156146
@Override
157147
public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType) {
158148
final StringBuilder pattern = new StringBuilder();

hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ protected <T extends JdbcOperation> SqlAstTranslator<T> buildTranslator(
407407
* no functions at all for calendaring, but we can
408408
* emulate the most basic functionality of extract()
409409
* using the functions it does have.
410-
*
410+
* <p>
411411
* The only supported {@link TemporalUnit}s are:
412412
* {@link TemporalUnit#YEAR},
413413
* {@link TemporalUnit#MONTH}
@@ -559,11 +559,6 @@ public boolean supportsCommentOn() {
559559
return false;
560560
}
561561

562-
@Override
563-
public RowLockStrategy getWriteRowLockStrategy() {
564-
return RowLockStrategy.NONE;
565-
}
566-
567562
@Override
568563
public RowLockStrategy getReadRowLockStrategy() {
569564
return RowLockStrategy.NONE;

hibernate-core/src/main/java/org/hibernate/dialect/DerbySqlAstTranslator.java

-5
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,6 @@ protected void visitAnsiCaseSimpleExpression(
183183
}
184184
}
185185

186-
@Override
187-
protected String getForUpdate() {
188-
return " for update";
189-
}
190-
191186
@Override
192187
protected String getForShare(int timeoutMillis) {
193188
return " for read only";

hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@
179179
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
180180
import org.hibernate.type.descriptor.jdbc.JdbcLiteralFormatter;
181181
import org.hibernate.type.descriptor.jdbc.JdbcType;
182-
import org.hibernate.type.descriptor.jdbc.JdbcTypeConstructor;
183182
import org.hibernate.type.descriptor.jdbc.LongNVarcharJdbcType;
184183
import org.hibernate.type.descriptor.jdbc.NCharJdbcType;
185184
import org.hibernate.type.descriptor.jdbc.NClobJdbcType;
@@ -1588,8 +1587,8 @@ private boolean sameColumnType(int typeCode1, int typeCode2) {
15881587
* <p>
15891588
* An implementation may set configuration properties from
15901589
* {@link #initDefaultProperties()}, though it is discouraged.
1591-
*
1592-
* @return a set of Hibernate configuration properties
1590+
the
1591+
* @return the Hibernate configuration properties
15931592
*
15941593
* @see #initDefaultProperties()
15951594
*/
@@ -1778,9 +1777,7 @@ public Blob mergeBlob(Blob original, Blob target, SharedSessionContractImplement
17781777
}
17791778
final JdbcServices jdbcServices = session.getFactory().getFastSessionServices().jdbcServices;
17801779
try {
1781-
final LobCreator lobCreator = jdbcServices.getLobCreator(
1782-
session
1783-
);
1780+
final LobCreator lobCreator = jdbcServices.getLobCreator( session );
17841781
return original == null
17851782
? lobCreator.createBlob( ArrayHelper.EMPTY_BYTE_ARRAY )
17861783
: lobCreator.createBlob( original.getBinaryStream(), original.length() );
@@ -4575,7 +4572,7 @@ public String addSqlHintOrComment(
45754572
// Keep this here, rather than moving to Select.
45764573
// Some Dialects may need the hint to be appended to the very end or beginning
45774574
// of the finalized SQL statement, so wait until everything is processed.
4578-
if ( queryOptions.getDatabaseHints() != null && queryOptions.getDatabaseHints().size() > 0 ) {
4575+
if ( queryOptions.getDatabaseHints() != null && !queryOptions.getDatabaseHints().isEmpty() ) {
45794576
sql = getQueryHintString( sql, queryOptions.getDatabaseHints() );
45804577
}
45814578
if ( commentsEnabled && queryOptions.getComment() != null ) {

hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import org.hibernate.sql.exec.spi.JdbcOperation;
6464
import org.hibernate.sql.model.MutationOperation;
6565
import org.hibernate.sql.model.internal.OptionalTableUpdate;
66-
import org.hibernate.sql.model.jdbc.OptionalTableUpdateOperation;
6766
import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl;
6867
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
6968
import org.hibernate.type.descriptor.jdbc.H2FormatJsonJdbcType;
@@ -335,11 +334,11 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
335334
}
336335

337336
/**
338-
* H2 requires a very special emulation, because {@code unnest} is pretty much useless,
339-
* due to https://github.com/h2database/h2database/issues/1815.
340-
* This emulation uses {@code array_get}, {@code array_length} and {@code system_range} functions to roughly achieve the same,
341-
* but requires that {@code system_range} is fed with a "maximum array size".
342-
*/
337+
* H2 requires a very special emulation, because {@code unnest} is pretty much useless,
338+
* due to <a href="https://github.com/h2database/h2database/issues/1815">issue 1815</a>.
339+
* This emulation uses {@code array_get}, {@code array_length} and {@code system_range} functions to roughly achieve the same,
340+
* but requires that {@code system_range} is fed with a "maximum array size".
341+
*/
343342
protected int getMaximumArraySize() {
344343
return 1000;
345344
}
@@ -954,12 +953,12 @@ private static MutationOperation usingMerge(
954953
return translator.createMergeOperation( optionalTableUpdate );
955954
}
956955

957-
private static MutationOperation withoutMerge(
958-
EntityMutationTarget mutationTarget,
959-
OptionalTableUpdate optionalTableUpdate,
960-
SessionFactoryImplementor factory) {
961-
return new OptionalTableUpdateOperation( mutationTarget, optionalTableUpdate, factory );
962-
}
956+
// private static MutationOperation withoutMerge(
957+
// EntityMutationTarget mutationTarget,
958+
// OptionalTableUpdate optionalTableUpdate,
959+
// SessionFactoryImplementor factory) {
960+
// return new OptionalTableUpdateOperation( mutationTarget, optionalTableUpdate, factory );
961+
// }
963962

964963
@Override
965964
public ParameterMarkerStrategy getNativeParameterMarkerStrategy() {

hibernate-core/src/main/java/org/hibernate/dialect/H2SqlAstTranslator.java

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.hibernate.sql.ast.Clause;
1818
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
1919
import org.hibernate.sql.ast.spi.SqlSelection;
20-
import org.hibernate.sql.ast.tree.MutationStatement;
2120
import org.hibernate.sql.ast.tree.Statement;
2221
import org.hibernate.sql.ast.tree.cte.CteContainer;
2322
import org.hibernate.sql.ast.tree.cte.CteTableGroup;

hibernate-core/src/main/java/org/hibernate/dialect/HANASqlAstTranslator.java

-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@
88

99
import java.util.List;
1010

11-
import org.hibernate.LockMode;
1211
import org.hibernate.MappingException;
1312
import org.hibernate.engine.spi.SessionFactoryImplementor;
1413
import org.hibernate.internal.util.collections.Stack;
1514
import org.hibernate.query.IllegalQueryOperationException;
16-
import org.hibernate.query.sqm.BinaryArithmeticOperator;
1715
import org.hibernate.query.sqm.ComparisonOperator;
1816
import org.hibernate.sql.ast.Clause;
1917
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
2018
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
2119
import org.hibernate.sql.ast.tree.Statement;
2220
import org.hibernate.sql.ast.tree.cte.CteStatement;
23-
import org.hibernate.sql.ast.tree.delete.DeleteStatement;
24-
import org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression;
2521
import org.hibernate.sql.ast.tree.expression.Expression;
2622
import org.hibernate.sql.ast.tree.expression.Literal;
2723
import org.hibernate.sql.ast.tree.expression.Summarization;

hibernate-core/src/main/java/org/hibernate/dialect/HSQLDialect.java

-5
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,6 @@ public boolean supportsLockTimeouts() {
369369
return false;
370370
}
371371

372-
@Override
373-
public String getForUpdateString() {
374-
return " for update";
375-
}
376-
377372
@Override
378373
public LimitHandler getLimitHandler() {
379374
return OffsetFetchLimitHandler.INSTANCE;

hibernate-core/src/main/java/org/hibernate/dialect/HSQLSqlAstTranslator.java

-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@
1818
import org.hibernate.sql.ast.SqlAstNodeRenderingMode;
1919
import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
2020
import org.hibernate.sql.ast.spi.SqlSelection;
21-
import org.hibernate.sql.ast.tree.MutationStatement;
2221
import org.hibernate.sql.ast.tree.Statement;
2322
import org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression;
2423
import org.hibernate.sql.ast.tree.expression.CaseSearchedExpression;
2524
import org.hibernate.sql.ast.tree.expression.CaseSimpleExpression;
26-
import org.hibernate.sql.ast.tree.expression.ColumnReference;
2725
import org.hibernate.sql.ast.tree.expression.Expression;
2826
import org.hibernate.sql.ast.tree.expression.Literal;
2927
import org.hibernate.sql.ast.tree.expression.SqlTuple;

hibernate-core/src/main/java/org/hibernate/dialect/MariaDBDialect.java

-5
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,6 @@ public boolean doesRoundTemporalOnOverflow() {
185185
return false;
186186
}
187187

188-
@Override
189-
protected MySQLStorageEngine getDefaultMySQLStorageEngine() {
190-
return InnoDBStorageEngine.INSTANCE;
191-
}
192-
193188
@Override
194189
public boolean supportsIfExistsBeforeConstraintName() {
195190
return true;

hibernate-core/src/main/java/org/hibernate/dialect/MariaDBSqlAstTranslator.java

-5
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ protected boolean shouldEmulateFetchClause(QueryPart queryPart) {
228228
return useOffsetFetchClause( queryPart ) && getQueryPartForRowNumbering() != queryPart && supportsWindowFunctions() && !isRowsOnlyFetchClauseType( queryPart );
229229
}
230230

231-
@Override
232-
protected boolean supportsSimpleQueryGrouping() {
233-
return true;
234-
}
235-
236231
@Override
237232
protected boolean shouldEmulateLateralWithIntersect(QueryPart queryPart) {
238233
// Intersect emulation requires nested correlation when no simple query grouping is possible

hibernate-core/src/main/java/org/hibernate/dialect/OracleArrayJdbcType.java

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
import static java.sql.Types.ARRAY;
3737
import static java.util.Collections.emptySet;
38-
import static org.hibernate.internal.util.collections.ArrayHelper.EMPTY_STRING_ARRAY;
3938

4039
/**
4140
* Descriptor for {@link Types#ARRAY ARRAY} handling.

hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
import org.hibernate.type.descriptor.jdbc.AggregateJdbcType;
8585
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
8686
import org.hibernate.type.descriptor.jdbc.JdbcType;
87-
import org.hibernate.type.descriptor.jdbc.JdbcTypeConstructor;
8887
import org.hibernate.type.descriptor.jdbc.NullJdbcType;
8988
import org.hibernate.type.descriptor.jdbc.ObjectNullAsNullTypeJdbcType;
9089
import org.hibernate.type.descriptor.jdbc.OracleJsonBlobJdbcType;

hibernate-core/src/main/java/org/hibernate/dialect/OracleNestedTableJdbcType.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import static java.sql.Types.ARRAY;
3636
import static java.util.Collections.emptySet;
3737
import static org.hibernate.internal.util.StringHelper.truncate;
38-
import static org.hibernate.internal.util.collections.ArrayHelper.EMPTY_STRING_ARRAY;
3938

4039
/**
4140
* Descriptor for {@link Types#ARRAY ARRAY} handling.
@@ -113,13 +112,13 @@ protected void doBindNull(CallableStatement st, String name, WrapperOptions opti
113112

114113
@Override
115114
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
116-
st.setArray( index, getArray( value, containerJavaType, options ) );
115+
st.setArray( index, getArray( value, options ) );
117116
}
118117

119118
@Override
120119
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
121120
throws SQLException {
122-
final java.sql.Array arr = getArray( value, containerJavaType, options );
121+
final java.sql.Array arr = getArray( value, options );
123122
try {
124123
st.setObject( name, arr, ARRAY );
125124
}
@@ -128,7 +127,7 @@ protected void doBind(CallableStatement st, X value, String name, WrapperOptions
128127
}
129128
}
130129

131-
private java.sql.Array getArray(X value, BasicPluralJavaType<X> containerJavaType, WrapperOptions options)
130+
private java.sql.Array getArray(X value, WrapperOptions options)
132131
throws SQLException {
133132
//noinspection unchecked
134133
final Class<Object[]> arrayClass = (Class<Object[]>) Array.newInstance(

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLCastingIntervalSecondJdbcType.java

+6-15
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.sql.ResultSet;
1313
import java.sql.SQLException;
1414

15-
import org.hibernate.engine.jdbc.spi.JdbcServices;
1615
import org.hibernate.engine.spi.SessionFactoryImplementor;
1716
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
1817
import org.hibernate.sql.ast.SqlAstTranslator;
@@ -40,25 +39,17 @@ public class PostgreSQLCastingIntervalSecondJdbcType implements AdjustableJdbcTy
4039

4140
@Override
4241
public JdbcType resolveIndicatedType(JdbcTypeIndicators indicators, JavaType<?> domainJtd) {
43-
final int scale;
44-
if ( indicators.getColumnScale() == JdbcTypeIndicators.NO_COLUMN_SCALE ) {
45-
scale = domainJtd.getDefaultSqlScale(
46-
indicators.getTypeConfiguration()
47-
.getServiceRegistry()
48-
.getService( JdbcServices.class )
49-
.getDialect(),
50-
this
51-
);
52-
}
53-
else {
54-
scale = indicators.getColumnScale();
55-
}
42+
final int scale = indicators.getColumnScale() == JdbcTypeIndicators.NO_COLUMN_SCALE
43+
? domainJtd.getDefaultSqlScale( indicators.getDialect(), this )
44+
: indicators.getColumnScale();
5645
if ( scale > 6 ) {
5746
// Since the maximum allowed scale on PostgreSQL is 6 (microsecond precision),
5847
// we have to switch to the numeric type if the value is greater
5948
return indicators.getTypeConfiguration().getJdbcTypeRegistry().getDescriptor( SqlTypes.NUMERIC );
6049
}
61-
return this;
50+
else {
51+
return this;
52+
}
6253
}
6354

6455
@Override

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
8383
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
8484
import org.hibernate.type.descriptor.jdbc.JdbcType;
85-
import org.hibernate.type.descriptor.jdbc.JdbcTypeConstructor;
8685
import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcType;
8786
import org.hibernate.type.descriptor.jdbc.XmlJdbcType;
8887
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLUUIDJdbcType.java

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.sql.CallableStatement;
1010
import java.sql.PreparedStatement;
1111
import java.sql.SQLException;
12-
import java.sql.Types;
1312
import java.util.UUID;
1413

1514
import org.hibernate.type.descriptor.ValueBinder;

0 commit comments

Comments
 (0)