[jOOQ/jOOQ#14841] ERROR: type blob does not exist when casting NULL as a domain converted as user defined type using class literal

This commit is contained in:
Lukas Eder 2023-04-06 13:18:30 +02:00
parent 69444fd3bf
commit cedbbde925

View File

@ -40,10 +40,16 @@ package org.jooq.impl;
import static org.jooq.impl.Internal.converterContext;
import org.jooq.Binding;
import org.jooq.CharacterSet;
import org.jooq.Collation;
import org.jooq.Configuration;
import org.jooq.Converter;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.Generator;
import org.jooq.Nullability;
import org.jooq.impl.QOM.GenerationLocation;
import org.jooq.impl.QOM.GenerationOption;
import org.jooq.ContextConverter;
/**
@ -55,10 +61,10 @@ import org.jooq.ContextConverter;
@Deprecated
final class LegacyConvertedDataType<T, U> extends DefaultDataType<U> {
private final DataType<T> delegate;
private final AbstractDataTypeX<T> delegate;
@SuppressWarnings("unchecked")
LegacyConvertedDataType(AbstractDataType<T> delegate, Binding<? super T, U> binding) {
LegacyConvertedDataType(AbstractDataTypeX<T> delegate, Binding<? super T, U> binding) {
super(
null,
binding.converter().toType(),
@ -76,6 +82,41 @@ final class LegacyConvertedDataType<T, U> extends DefaultDataType<U> {
this.delegate = delegate;
}
@SuppressWarnings("unchecked")
@Override
DefaultDataType<U> construct(
Integer newPrecision,
Integer newScale,
Integer newLength,
Nullability newNullability,
boolean newReadonly,
Generator<?, ?, U> newGeneratedAlwaysAs,
GenerationOption newGenerationOption,
GenerationLocation newGenerationLocation,
Collation newCollation,
CharacterSet newCharacterSet,
boolean newIdentity,
Field<U> newDefaultValue
) {
return new LegacyConvertedDataType<>(
((AbstractDataTypeX) delegate).construct(
newPrecision,
newScale,
newLength,
newNullability,
newReadonly,
newGeneratedAlwaysAs,
newGenerationOption,
newGenerationLocation,
newCollation,
newCharacterSet,
newIdentity,
newDefaultValue
),
(Binding<T, U>) getBinding()
);
}
@Override
public int getSQLType() {
return delegate.getSQLType();