HHH-18150 Considered change of ignoring precision while preserving float/smallfloat mapping
This commit is contained in:
parent
1f6fdb3f1d
commit
88eaa2c899
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.community.dialect;
|
package org.hibernate.community.dialect;
|
||||||
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import java.sql.Types;
|
|
||||||
|
|
||||||
import org.hibernate.boot.model.FunctionContributions;
|
import org.hibernate.boot.model.FunctionContributions;
|
||||||
import org.hibernate.boot.model.TypeContributions;
|
import org.hibernate.boot.model.TypeContributions;
|
||||||
|
@ -29,7 +28,6 @@ import org.hibernate.dialect.sequence.SequenceSupport;
|
||||||
import org.hibernate.dialect.temptable.TemporaryTable;
|
import org.hibernate.dialect.temptable.TemporaryTable;
|
||||||
import org.hibernate.dialect.temptable.TemporaryTableKind;
|
import org.hibernate.dialect.temptable.TemporaryTableKind;
|
||||||
import org.hibernate.dialect.unique.UniqueDelegate;
|
import org.hibernate.dialect.unique.UniqueDelegate;
|
||||||
import org.hibernate.engine.jdbc.Size;
|
|
||||||
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
@ -65,8 +63,6 @@ import org.hibernate.sql.exec.spi.JdbcOperation;
|
||||||
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
||||||
import org.hibernate.tool.schema.internal.StandardForeignKeyExporter;
|
import org.hibernate.tool.schema.internal.StandardForeignKeyExporter;
|
||||||
import org.hibernate.tool.schema.spi.Exporter;
|
import org.hibernate.tool.schema.spi.Exporter;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
|
||||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
|
||||||
import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType;
|
import org.hibernate.type.descriptor.sql.internal.CapacityDependentDdlType;
|
||||||
import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
|
import org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
@ -119,24 +115,6 @@ public class InformixDialect extends Dialect {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final SizeStrategy sizeStrategy = new SizeStrategyImpl() {
|
|
||||||
@Override
|
|
||||||
public Size resolveSize(
|
|
||||||
JdbcType jdbcType,
|
|
||||||
JavaType<?> javaType,
|
|
||||||
Integer precision,
|
|
||||||
Integer scale,
|
|
||||||
Long length) {
|
|
||||||
switch ( jdbcType.getDdlTypeCode() ) {
|
|
||||||
case Types.FLOAT:
|
|
||||||
// Informix allows FLOAT with a precision up to 16
|
|
||||||
if ( precision != null ) {
|
|
||||||
return Size.precision( Math.min( Math.max( precision, 1 ), 16 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.resolveSize( jdbcType, javaType, precision, scale, length );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public InformixDialect(DialectResolutionInfo info) {
|
public InformixDialect(DialectResolutionInfo info) {
|
||||||
this( info.makeCopyOrDefault( DEFAULT_VERSION ) );
|
this( info.makeCopyOrDefault( DEFAULT_VERSION ) );
|
||||||
registerKeywords( info );
|
registerKeywords( info );
|
||||||
|
@ -201,7 +179,7 @@ public class InformixDialect extends Dialect {
|
||||||
//float(n) and just always defaults to
|
//float(n) and just always defaults to
|
||||||
//double precision.
|
//double precision.
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( FLOAT, "float($p)", this )
|
CapacityDependentDdlType.builder( FLOAT, "float", this )
|
||||||
.withTypeCapacity( 8, "smallfloat" )
|
.withTypeCapacity( 8, "smallfloat" )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -259,11 +237,6 @@ public class InformixDialect extends Dialect {
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SizeStrategy getSizeStrategy() {
|
|
||||||
return sizeStrategy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeFunctionRegistry(FunctionContributions functionContributions) {
|
public void initializeFunctionRegistry(FunctionContributions functionContributions) {
|
||||||
super.initializeFunctionRegistry(functionContributions);
|
super.initializeFunctionRegistry(functionContributions);
|
||||||
|
|
Loading…
Reference in New Issue