diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java index c61fd09e73..5a4aacab0f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java @@ -66,6 +66,10 @@ import org.jooq.UDTRecord; import org.jooq.exception.SQLDialectNotSupportedException; import org.jooq.tools.Convert; import org.jooq.types.Interval; +import org.jooq.types.UByte; +import org.jooq.types.UInteger; +import org.jooq.types.ULong; +import org.jooq.types.UShort; /** * A common base class for data types. @@ -229,6 +233,22 @@ public class DefaultDataType implements DataType { this.castTypeName = castTypeName; this.castTypeBase = TYPE_NAME_PATTERN.matcher(castTypeName).replaceAll("").trim(); this.arrayType = (Class) Array.newInstance(type, 0).getClass(); + + if (precision == 0) { + if (type == Long.class || type == ULong.class) { + precision = LONG_PRECISION; + } + else if (type == Integer.class || type == UInteger.class) { + precision = INTEGER_PRECISION; + } + else if (type == Short.class || type == UShort.class) { + precision = SHORT_PRECISION; + } + else if (type == Byte.class || type == UByte.class) { + precision = BYTE_PRECISION; + } + } + this.precision = precision; this.scale = scale; this.length = length;