本文整理汇总了Java中org.hibernate.type.descriptor.sql.SqlTypeDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java SqlTypeDescriptor类的具体用法?Java SqlTypeDescriptor怎么用?Java SqlTypeDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlTypeDescriptor类属于org.hibernate.type.descriptor.sql包,在下文中一共展示了SqlTypeDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) {
switch ( sqlCode ) {
case Types.BOOLEAN:
return BitTypeDescriptor.INSTANCE;
case Types.CLOB:
return HANA_CLOB_STREAM_BINDING;
case Types.NCLOB:
return HANA_NCLOB_STREAM_BINDING;
case Types.TINYINT:
// tinyint is unsigned on HANA
return SmallIntTypeDescriptor.INSTANCE;
default:
return super.getSqlTypeDescriptorOverride( sqlCode );
}
}
示例2: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
public SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
SqlTypeDescriptor descriptor;
switch ( sqlCode ) {
case Types.BLOB: {
// Force BLOB binding. Otherwise, byte[] fields annotated
// with @Lob will attempt to use
// BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING. Since the
// dialect uses oid for Blobs, byte arrays cannot be used.
descriptor = BlobTypeDescriptor.BLOB_BINDING;
break;
}
case Types.CLOB: {
descriptor = ClobTypeDescriptor.CLOB_BINDING;
break;
}
default: {
descriptor = super.getSqlTypeDescriptorOverride( sqlCode );
break;
}
}
return descriptor;
}
示例3: getOptions
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
private WrapperOptions getOptions(final SessionImplementor session) {
return new WrapperOptions() {
public boolean useStreamForLobBinding() {
return Environment.useStreamsForBinary()
|| session.getFactory().getDialect().useInputStreamToInsertBlob();
}
public LobCreator getLobCreator() {
return Hibernate.getLobCreator( session );
}
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
final SqlTypeDescriptor remapped = sqlTypeDescriptor.canBeRemapped()
? session.getFactory().getDialect().remapSqlTypeDescriptor( sqlTypeDescriptor )
: sqlTypeDescriptor;
return remapped == null ? sqlTypeDescriptor : remapped;
}
};
}
示例4: getBinder
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>(javaTypeDescriptor, (SqlTypeDescriptor) this) {
@Override
protected void doBind(PreparedStatement st, X value, int index,
WrapperOptions options) throws SQLException {
if (cal == null) {
st.setDate(index,
javaTypeDescriptor.unwrap(value, Date.class, options));
} else {
st.setDate(index,
javaTypeDescriptor.unwrap(value, Date.class, options), cal);
}
}
};
}
示例5: remapSqlTypeDescriptor
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
if (sqlTypeDescriptor.getSqlType() == java.sql.Types.BLOB) {
return BinaryTypeDescriptor.INSTANCE;
}
return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
}
示例6: remapSqlTypeDescriptor
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
if (Types.CLOB == sqlTypeDescriptor.getSqlType()) {
return LongVarcharTypeDescriptor.INSTANCE;
}
return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
}
示例7: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
switch (sqlCode) {
case Types.BLOB:
return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING;
case Types.CLOB:
// Some Sybase drivers cannot support getClob. See HHH-7889
return ClobTypeDescriptor.STREAM_BINDING_EXTRACTING;
default:
return super.getSqlTypeDescriptorOverride( sqlCode );
}
}
示例8: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
/**
* Returns the {@link SqlTypeDescriptor} that should be used to handle the given JDBC type code. Returns
* {@code null} if there is no override.
*
* @param sqlCode A {@link Types} constant indicating the SQL column type
* @return The {@link SqlTypeDescriptor} to use as an override, or {@code null} if there is no override.
*/
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
SqlTypeDescriptor descriptor;
switch ( sqlCode ) {
case Types.CLOB: {
descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null;
break;
}
default: {
descriptor = null;
break;
}
}
return descriptor;
}
示例9: AttributeConverterTypeAdapter
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
public AttributeConverterTypeAdapter(
String name,
AttributeConverter<? extends T,?> attributeConverter,
SqlTypeDescriptor sqlTypeDescriptorAdapter,
Class modelType,
Class jdbcType,
JavaTypeDescriptor<T> entityAttributeJavaTypeDescriptor) {
super( sqlTypeDescriptorAdapter, entityAttributeJavaTypeDescriptor );
this.name = name;
this.modelType = modelType;
this.jdbcType = jdbcType;
this.attributeConverter = attributeConverter;
log.debug( "Created AttributeConverterTypeAdapter -> " + name );
}
示例10: AttributeConverterSqlTypeDescriptorAdapter
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
public AttributeConverterSqlTypeDescriptorAdapter(
AttributeConverter converter,
SqlTypeDescriptor delegate,
JavaTypeDescriptor intermediateJavaTypeDescriptor) {
this.converter = converter;
this.delegate = delegate;
this.intermediateJavaTypeDescriptor = intermediateJavaTypeDescriptor;
}
示例11: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
public SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
if (Types.BLOB == sqlCode) {
return LongVarbinaryTypeDescriptor.INSTANCE;
}
return super.getSqlTypeDescriptorOverride(sqlCode);
}
示例12: getExtractor
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
public <X> ValueExtractor<X> getExtractor(
final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>(javaTypeDescriptor, (SqlTypeDescriptor) this) {
@Override
protected X doExtract(ResultSet rs, String name,
WrapperOptions options) throws SQLException {
if (cal == null) {
return javaTypeDescriptor.wrap(rs.getDate(name), options);
} else {
return javaTypeDescriptor.wrap(rs.getDate(name, cal), options);
}
}
};
}
示例13: remapSqlTypeDescriptor
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
{
if (sqlTypeDescriptor.getSqlType() == java.sql.Types.BLOB)
return BinaryTypeDescriptor.INSTANCE;
else
return super.remapSqlTypeDescriptor(sqlTypeDescriptor);
}
示例14: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return sqlCode == Types.BOOLEAN ? TinyIntTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
}
示例15: getSqlTypeDescriptorOverride
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor; //导入依赖的package包/类
@Override
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) {
return sqlCode == Types.BOOLEAN ? BitTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode );
}