Search in sources :

Example 1 with BlobJdbcType

use of org.hibernate.type.descriptor.jdbc.BlobJdbcType in project hibernate-orm by hibernate.

the class OracleDialect method contributeTypes.

@Override
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    super.contributeTypes(typeContributions, serviceRegistry);
    if (getVersion().isSameOrAfter(12)) {
        // account for Oracle's deprecated support for LONGVARBINARY
        // prefer BLOB, unless the user explicitly opts out
        boolean preferLong = serviceRegistry.getService(ConfigurationService.class).getSetting(PREFER_LONG_RAW, StandardConverters.BOOLEAN, false);
        BlobJdbcType descriptor = preferLong ? BlobJdbcType.PRIMITIVE_ARRAY_BINDING : BlobJdbcType.DEFAULT;
        typeContributions.contributeJdbcType(descriptor);
    }
    // Oracle requires a custom binder for binding untyped nulls with the NULL type
    typeContributions.contributeJdbcType(NullJdbcType.INSTANCE);
    typeContributions.contributeJdbcType(ObjectNullAsNullTypeJdbcType.INSTANCE);
    // Until we remove StandardBasicTypes, we have to keep this
    typeContributions.contributeType(new NullType(NullJdbcType.INSTANCE, typeContributions.getTypeConfiguration().getJavaTypeRegistry().getDescriptor(Object.class)));
    typeContributions.contributeType(new JavaObjectType(ObjectNullAsNullTypeJdbcType.INSTANCE, typeContributions.getTypeConfiguration().getJavaTypeRegistry().getDescriptor(Object.class)));
}
Also used : ConfigurationService(org.hibernate.engine.config.spi.ConfigurationService) NullType(org.hibernate.type.NullType) BlobJdbcType(org.hibernate.type.descriptor.jdbc.BlobJdbcType) JavaObjectType(org.hibernate.type.JavaObjectType)

Aggregations

ConfigurationService (org.hibernate.engine.config.spi.ConfigurationService)1 JavaObjectType (org.hibernate.type.JavaObjectType)1 NullType (org.hibernate.type.NullType)1 BlobJdbcType (org.hibernate.type.descriptor.jdbc.BlobJdbcType)1