clean up very old Dialect javadoc

and squash a couple of warnings
This commit is contained in:
Gavin King 2022-01-20 11:56:14 +01:00
parent 019f87106a
commit e6a9220606
13 changed files with 50 additions and 33 deletions

View File

@ -62,7 +62,7 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTime;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros;
/**
* A dialect for CockroachDB.
* A {@linkplain Dialect SQL dialect} for CockroachDB.
*
* @author Gavin King
*/

View File

@ -65,7 +65,7 @@ import jakarta.persistence.TemporalType;
import static org.hibernate.type.SqlTypes.*;
/**
* An SQL dialect for DB2.
* A {@linkplain Dialect SQL dialect} for DB2.
*
* @author Gavin King
*/

View File

@ -76,7 +76,7 @@ import static org.hibernate.query.sqm.produce.function.StandardFunctionReturnTyp
import static org.hibernate.type.SqlTypes.*;
/**
* Hibernate Dialect for Apache Derby / Cloudscape 10
* A {@linkplain Dialect SQL dialect} for Apache Derby.
*
* @author Simon Johnston
* @author Gavin King

View File

@ -176,16 +176,37 @@ import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTime;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros;
/**
* Represents a dialect of SQL implemented by a particular RDBMS. Subclasses
* implement Hibernate compatibility with different database platforms.
* Represents a dialect of SQL implemented by a particular RDBMS. Every
* subclass of this class implements support for a certain database
* platform. For example, {@link PostgreSQLDialect} implements support
* for PostgreSQL, and {@link MySQLDialect} implements support for MySQL.
* <p>
* Subclasses must provide a public constructor that registers a set of type
* mappings from JDBC type codes to database native type names, along with
* default Hibernate properties. This constructor may have no parameters, or
* it may have a single parameter of type
* {@link org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo}.
* A subclass must provide a public constructor with a single parameter
* of type {@link DialectResolutionInfo}. Alternatively, for purposes of
* backward compatibility with older versions of Hibernate, a constructor
* with no parameters is also allowed.
* <p>
* Subclasses should be immutable.
* Almost every subclass must, as a bare minimum, override at least:
* <ul>
* <li>{@link #columnType(int)} to define a mapping from JDBC
* {@linkplain Types type codes} to database column types, and
* <li>{@link #initializeFunctionRegistry(QueryEngine)} to register
* mappings for standard HQL functions with the
* {@link org.hibernate.query.sqm.function.SqmFunctionRegistry}.
* </ul>
* A subclass representing a dialect of SQL which deviates significantly
* from ANSI SQL will certainly override many additional operations.
* <p>
* Subclasses should be threadsafe and immutable.
* <p>
* Since Hibernate 6, a single subclass of {@code Dialect} represents all
* releases of a given product-specific SQL dialect. The version of the
* database is exposed at runtime via the {@link DialectResolutionInfo}
* passed to the constructor, and by the {@link #getVersion()} property.
* <p>
* Programs using Hibernate should migrate away from the use of versioned
* dialect classes like, for example, {@link PostgreSQL95Dialect}. These
* classes are now deprecated and will be removed in a future release.
*
* @author Gavin King, David Channon
*/

View File

@ -69,7 +69,7 @@ import static org.hibernate.query.TemporalUnit.SECOND;
import static org.hibernate.type.SqlTypes.*;
/**
* A dialect compatible with the H2 database.
* A {@linkplain Dialect SQL dialect} for H2.
*
* @author Thomas Mueller
*/
@ -82,7 +82,6 @@ public class H2Dialect extends Dialect {
private final boolean cascadeConstraints;
private final boolean useLocalTime;
private final boolean supportsTuplesInSubqueries;
private final SequenceInformationExtractor sequenceInformationExtractor;
private final String querySequenceString;
@ -107,7 +106,7 @@ public class H2Dialect extends Dialect {
LOG.unsupportedMultiTableBulkHqlJpaql( version.getMajor(), version.getMinor(), version.getMicro() );
}
supportsTuplesInSubqueries = version.isSameOrAfter( 1, 4, 198 );
// supportsTuplesInSubqueries = version.isSameOrAfter( 1, 4, 198 );
// Prior to 1.4.200 there was no support for 'current value for sequence_name'
// After 2.0.202 there is no support for 'sequence_name.nextval' and 'sequence_name.currval'
@ -473,20 +472,20 @@ public class H2Dialect extends Dialect {
private static final ViolatedConstraintNameExtractor EXTRACTOR =
new TemplatedViolatedConstraintNameExtractor( sqle -> {
String constraintName = null;
// 23000: Check constraint violation: {0}
// 23001: Unique index or primary key violation: {0}
if ( sqle.getSQLState().startsWith( "23" ) ) {
final String message = sqle.getMessage();
final int idx = message.indexOf( "violation: " );
if ( idx > 0 ) {
constraintName = message.substring( idx + "violation: ".length() );
}
if ( sqle.getSQLState().equals( "23506" ) ) {
constraintName = constraintName.substring( 1, constraintName.indexOf( ":" ) );
String constraintName = message.substring( idx + "violation: ".length() );
if ( sqle.getSQLState().equals( "23506" ) ) {
constraintName = constraintName.substring( 1, constraintName.indexOf( ":" ) );
}
return constraintName;
}
}
return constraintName;
return null;
} );
@Override

View File

@ -79,7 +79,7 @@ import static org.hibernate.type.SqlTypes.NCLOB;
import static org.hibernate.type.SqlTypes.NUMERIC;
/**
* An SQL dialect compatible with HyperSQL (HSQLDB) version 1.8 and above.
* A {@linkplain Dialect SQL dialect} for HSQLDB (HyperSQL) 1.8 and above.
*
* @author Christoph Sturm
* @author Phillip Baird

View File

@ -27,7 +27,7 @@ import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
import org.hibernate.type.StandardBasicTypes;
/**
* SQL dialect for MariaDB
* A {@linkplain Dialect SQL dialect} for MariaDB
*
* @author Vlad Mihalcea
* @author Gavin King

View File

@ -81,7 +81,7 @@ import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtract
import static org.hibernate.type.SqlTypes.*;
/**
* An SQL dialect for MySQL (prior to 5.x).
* A {@linkplain Dialect SQL dialect} for MySQL 5 and above.
*
* @author Gavin King
*/

View File

@ -95,7 +95,7 @@ import org.hibernate.query.sqm.produce.function.FunctionParameterType;
import static org.hibernate.type.SqlTypes.*;
/**
* A dialect for Oracle 8i and above.
* A {@linkplain Dialect SQL dialect} for Oracle 8i and above.
*
* @author Steve Ebersole
* @author Gavin King

View File

@ -67,7 +67,6 @@ import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
import org.hibernate.sql.ast.tree.Statement;
import org.hibernate.sql.exec.spi.JdbcOperation;
import org.hibernate.type.JavaObjectType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor;
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
@ -85,14 +84,13 @@ import static org.hibernate.query.TemporalUnit.MONTH;
import static org.hibernate.query.TemporalUnit.QUARTER;
import static org.hibernate.query.TemporalUnit.YEAR;
import org.hibernate.query.sqm.produce.function.FunctionParameterType;
import static org.hibernate.type.SqlTypes.*;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsDate;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTime;
import static org.hibernate.type.descriptor.DateTimeUtils.appendAsTimestampWithMicros;
/**
* An SQL dialect for Postgres 8 and above.
* A {@linkplain Dialect SQL dialect} for PostgreSQL 8 and above.
*
* @author Gavin King
*/

View File

@ -55,7 +55,7 @@ import static org.hibernate.dialect.SimpleDatabaseVersion.ZERO_VERSION;
import static org.hibernate.type.SqlTypes.*;
/**
* Hibernate Dialect implementation for Cloud Spanner.
* A {@linkplain Dialect SQL dialect} for Cloud Spanner.
*
* @author Mike Eltsufin
* @author Chengyuan Zhao
@ -133,7 +133,8 @@ public class SpannerDialect extends Dialect {
return 2_621_440;
}
public int getMaxBytesLength() {
@Override
public int getMaxVarbinaryLength() {
//max is equivalent to 10_485_760
return 10_485_760;
}

View File

@ -46,8 +46,7 @@ import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtract
import static org.hibernate.type.SqlTypes.*;
/**
* Dialect for Sybase Adaptive Server Enterprise for
* Sybase 11.9.2 and above.
* A {@linkplain Dialect SQL dialect} for Sybase Adaptive Server Enterprise 11.9 and above.
*/
public class SybaseASEDialect extends SybaseDialect {
@ -589,7 +588,6 @@ public class SybaseASEDialect extends SybaseDialect {
}
@Override
@SuppressWarnings("deprecation")
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String, String[]> keyColumnNames) {
//TODO: is this really correct?
return getVersion().isBefore( 15, 7 )

View File

@ -22,7 +22,7 @@ import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorTi
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
/**
* An SQL dialect for TiDB (prior to 5.x).
* A {@linkplain Dialect SQL dialect} for TiDB.
*
* @author Cong Wang
*/