From 1cb6ff8916ef74efb020429aa6ebab4d9b5342f7 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Tue, 5 Oct 2021 17:34:32 +0200 Subject: [PATCH] Cleanup naming of JavaTypeDescriptor and JdbcTypeDescriptor implementations. Get rid of PrimitiveType, IdentifierType, DiscriminatorType and AllowableTemporalParameterType --- ...mmaDelimitedStringsJavaTypeDescriptor.java | 4 +- .../type/CommaDelimitedStringsType.java | 6 +- .../collections/type/TimestampEpochType.java | 13 +- .../mapping/basic/BitSetJavaType.java | 4 +- .../userguide/mapping/basic/BitSetType.java | 13 +- .../mapping/basic/CustomBinaryJdbcType.java | 6 +- .../basic/GenderJavaTypeDescriptor.java | 10 +- .../userguide/mapping/basic/GenderType.java | 6 +- .../community/dialect/SQLiteDialect.java | 8 +- .../org/hibernate/annotations/JavaType.java | 4 +- .../annotations/JavaTypeRegistration.java | 4 +- .../boot/model/TypeDefinitionRegistry.java | 4 +- .../TypeDefinitionRegistryStandardImpl.java | 4 +- .../internal/InferredBasicValueResolver.java | 49 +++--- .../internal/NamedConverterResolution.java | 8 +- .../process/internal/VersionResolution.java | 10 +- .../source/internal/hbm/ModelBinder.java | 13 +- .../org/hibernate/cfg/AnnotationBinder.java | 7 +- .../java/org/hibernate/cfg/BinderHelper.java | 6 +- .../cfg/annotations/BasicValueBinder.java | 8 +- .../dialect/AbstractHANADialect.java | 55 ++++--- .../dialect/AbstractTransactSQLDialect.java | 4 +- .../org/hibernate/dialect/DB2Dialect.java | 20 +-- .../org/hibernate/dialect/DerbyDialect.java | 12 +- .../java/org/hibernate/dialect/Dialect.java | 25 ++- .../org/hibernate/dialect/OracleDialect.java | 12 +- .../hibernate/dialect/PostgreSQLDialect.java | 12 +- .../hibernate/dialect/SQLServerDialect.java | 8 +- .../hibernate/dialect/SybaseASEDialect.java | 8 +- .../org/hibernate/dialect/SybaseDialect.java | 28 ++-- .../engine/internal/UnsavedValueFactory.java | 13 +- .../java/org/hibernate/id/UUIDGenerator.java | 12 +- .../internal/util/ReflectHelper.java | 7 +- .../java/org/hibernate/mapping/Array.java | 13 +- .../org/hibernate/mapping/BasicValue.java | 12 +- .../org/hibernate/mapping/SimpleValue.java | 4 +- .../AllowableTemporalParameterType.java | 24 --- .../model/domain/internal/ArrayTupleType.java | 6 +- .../persister/entity/DiscriminatorType.java | 15 +- .../entity/JoinedSubclassEntityPersister.java | 11 +- .../entity/SingleTableEntityPersister.java | 9 +- .../internal/FunctionReturnImpl.java | 4 +- .../internal/ProcedureParameterImpl.java | 22 +-- .../query/internal/BindingTypeHelper.java | 22 ++- .../tree/domain/SqmBasicValuedSimplePath.java | 6 +- .../sqm/tree/expression/LiteralHelper.java | 12 +- .../sqm/tree/predicate/SqmPredicate.java | 5 +- .../type/AbstractStandardBasicType.java | 4 +- .../org/hibernate/type/BasicTypeRegistry.java | 15 ++ .../org/hibernate/type/BigDecimalType.java | 6 +- .../org/hibernate/type/BigIntegerType.java | 13 +- .../java/org/hibernate/type/BinaryType.java | 6 +- .../java/org/hibernate/type/BlobType.java | 5 +- .../java/org/hibernate/type/BooleanType.java | 22 +-- .../java/org/hibernate/type/ByteType.java | 33 +--- .../org/hibernate/type/CalendarDateType.java | 32 +--- .../org/hibernate/type/CalendarTimeType.java | 32 +--- .../java/org/hibernate/type/CalendarType.java | 31 +--- .../org/hibernate/type/CharArrayType.java | 6 +- .../type/CharacterArrayClobType.java | 11 +- .../type/CharacterArrayNClobType.java | 6 +- .../hibernate/type/CharacterArrayType.java | 6 +- .../hibernate/type/CharacterNCharType.java | 23 +-- .../org/hibernate/type/CharacterType.java | 21 +-- .../java/org/hibernate/type/ClassType.java | 6 +- .../java/org/hibernate/type/ClobType.java | 5 +- .../java/org/hibernate/type/CurrencyType.java | 6 +- .../java/org/hibernate/type/CustomType.java | 17 +- .../java/org/hibernate/type/DateType.java | 39 +---- .../org/hibernate/type/DbTimestampType.java | 6 +- .../org/hibernate/type/DiscriminatorType.java | 32 ---- .../java/org/hibernate/type/DoubleType.java | 20 +-- .../java/org/hibernate/type/DurationType.java | 6 +- .../java/org/hibernate/type/EnumType.java | 10 +- .../java/org/hibernate/type/FloatType.java | 16 +- .../org/hibernate/type/IdentifierType.java | 28 ---- .../java/org/hibernate/type/ImageType.java | 6 +- .../java/org/hibernate/type/InstantType.java | 31 +--- .../java/org/hibernate/type/IntegerType.java | 26 +-- .../org/hibernate/type/JavaObjectType.java | 4 +- .../org/hibernate/type/LocalDateTimeType.java | 30 +--- .../org/hibernate/type/LocalDateType.java | 29 +--- .../org/hibernate/type/LocalTimeType.java | 30 +--- .../java/org/hibernate/type/LocaleType.java | 6 +- .../java/org/hibernate/type/LongType.java | 28 +--- .../hibernate/type/MaterializedBlobType.java | 6 +- .../hibernate/type/MaterializedClobType.java | 6 +- .../hibernate/type/MaterializedNClobType.java | 6 +- .../java/org/hibernate/type/NClobType.java | 5 +- .../java/org/hibernate/type/NTextType.java | 6 +- .../java/org/hibernate/type/NullType.java | 5 +- .../hibernate/type/NumericBooleanType.java | 28 +--- .../hibernate/type/OffsetDateTimeType.java | 35 +--- .../org/hibernate/type/OffsetTimeType.java | 29 +--- .../org/hibernate/type/PostgresUUIDType.java | 10 +- .../type/PrimitiveCharacterArrayClobType.java | 6 +- .../PrimitiveCharacterArrayNClobType.java | 6 +- .../org/hibernate/type/PrimitiveType.java | 40 ----- .../org/hibernate/type/RowVersionType.java | 6 +- .../type/SerializableToBlobType.java | 10 +- .../org/hibernate/type/SerializableType.java | 8 +- .../java/org/hibernate/type/ShortType.java | 26 +-- .../hibernate/type/StringNVarcharType.java | 17 +- .../java/org/hibernate/type/StringType.java | 16 +- .../java/org/hibernate/type/TextType.java | 6 +- .../java/org/hibernate/type/TimeType.java | 29 +--- .../java/org/hibernate/type/TimeZoneType.java | 6 +- .../org/hibernate/type/TimestampType.java | 37 +---- .../org/hibernate/type/TrueFalseType.java | 31 +--- .../org/hibernate/type/UUIDBinaryType.java | 6 +- .../java/org/hibernate/type/UUIDCharType.java | 6 +- .../main/java/org/hibernate/type/UrlType.java | 16 +- .../type/WrappedMaterializedBlobType.java | 6 +- .../org/hibernate/type/WrapperBinaryType.java | 6 +- .../java/org/hibernate/type/YesNoType.java | 31 +--- .../org/hibernate/type/ZoneOffsetType.java | 6 +- .../org/hibernate/type/ZonedDateTimeType.java | 26 +-- ...a => AbstractClassJavaTypeDescriptor.java} | 8 +- ...r.java => AbstractJavaTypeDescriptor.java} | 8 +- ...> AbstractTemporalJavaTypeDescriptor.java} | 6 +- ...ptor.java => BasicJavaTypeDescriptor.java} | 2 +- ...java => BigDecimalJavaTypeDescriptor.java} | 6 +- ...java => BigIntegerJavaTypeDescriptor.java} | 6 +- ...iptor.java => BlobJavaTypeDescriptor.java} | 10 +- ...or.java => BooleanJavaTypeDescriptor.java} | 11 +- ....java => ByteArrayJavaTypeDescriptor.java} | 6 +- ...iptor.java => ByteJavaTypeDescriptor.java} | 9 +- ...va => CalendarDateJavaTypeDescriptor.java} | 19 +-- ...r.java => CalendarJavaTypeDescriptor.java} | 18 +-- ...va => CalendarTimeJavaTypeDescriptor.java} | 20 +-- ... => CharacterArrayJavaTypeDescriptor.java} | 6 +- ....java => CharacterJavaTypeDescriptor.java} | 9 +- ...ptor.java => ClassJavaTypeDescriptor.java} | 6 +- ...iptor.java => ClobJavaTypeDescriptor.java} | 6 +- ...r.java => CurrencyJavaTypeDescriptor.java} | 6 +- ...iptor.java => DateJavaTypeDescriptor.java} | 18 +-- ...tor.java => DoubleJavaTypeDescriptor.java} | 13 +- ...r.java => DurationJavaTypeDescriptor.java} | 10 +- .../java/EnumJavaTypeDescriptor.java | 2 +- .../descriptor/java/FloatTypeDescriptor.java | 7 +- ...or.java => InstantJavaTypeDescriptor.java} | 14 +- ...or.java => IntegerJavaTypeDescriptor.java} | 10 +- ...r.java => JdbcDateJavaTypeDescriptor.java} | 10 +- ...r.java => JdbcTimeJavaTypeDescriptor.java} | 10 +- ...a => JdbcTimestampJavaTypeDescriptor.java} | 10 +- ....java => LocalDateJavaTypeDescriptor.java} | 10 +- ...a => LocalDateTimeJavaTypeDescriptor.java} | 10 +- ....java => LocalTimeJavaTypeDescriptor.java} | 10 +- ...tor.java => LocaleJavaTypeDescriptor.java} | 6 +- ...iptor.java => LongJavaTypeDescriptor.java} | 10 +- ...ptor.java => NClobJavaTypeDescriptor.java} | 6 +- ...ava => ObjectArrayJavaTypeDescriptor.java} | 4 +- ...tor.java => ObjectJavaTypeDescriptor.java} | 6 +- ... => OffsetDateTimeJavaTypeDescriptor.java} | 18 +-- ...java => OffsetTimeJavaTypeDescriptor.java} | 10 +- ...PrimitiveByteArrayJavaTypeDescriptor.java} | 6 +- ...tiveCharacterArrayJavaTypeDescriptor.java} | 6 +- ...java => RowVersionJavaTypeDescriptor.java} | 6 +- ...va => SerializableJavaTypeDescriptor.java} | 12 +- ...ptor.java => ShortJavaTypeDescriptor.java} | 10 +- ...tor.java => StringJavaTypeDescriptor.java} | 6 +- .../java/TemporalJavaTypeDescriptor.java | 23 ++- ...r.java => TimeZoneJavaTypeDescriptor.java} | 6 +- ...iptor.java => UUIDJavaTypeDescriptor.java} | 10 +- ...riptor.java => UrlJavaTypeDescriptor.java} | 10 +- ...java => ZoneOffsetJavaTypeDescriptor.java} | 8 +- .../java/ZonedDateTimeJavaTypeDescriptor.java | 14 +- .../spi/CollectionJavaTypeDescriptor.java | 4 +- .../java/spi/JavaTypeDescriptorBaseline.java | 150 +++++++++--------- .../spi/JavaTypeDescriptorBasicAdaptor.java | 4 +- .../java/spi/MapEntryJavaDescriptor.java | 4 +- ....java => PrimitiveJavaTypeDescriptor.java} | 4 +- .../descriptor/java/spi/RegistryHelper.java | 6 +- ...tor.java => BigIntJdbcTypeDescriptor.java} | 12 +- ...tor.java => BinaryJdbcTypeDescriptor.java} | 6 +- ...iptor.java => BlobJdbcTypeDescriptor.java} | 22 +-- ...or.java => BooleanJdbcTypeDescriptor.java} | 12 +- ...iptor.java => CharJdbcTypeDescriptor.java} | 6 +- ...iptor.java => ClobJdbcTypeDescriptor.java} | 14 +- ...iptor.java => DateJdbcTypeDescriptor.java} | 12 +- ...or.java => DecimalJdbcTypeDescriptor.java} | 12 +- ...tor.java => DoubleJdbcTypeDescriptor.java} | 12 +- ...ptor.java => FloatJdbcTypeDescriptor.java} | 14 +- ...or.java => IntegerJdbcTypeDescriptor.java} | 12 +- .../descriptor/jdbc/JdbcTypeDescriptor.java | 6 +- .../jdbc/JdbcTypeDescriptorIndicators.java | 3 +- ...va => LongNVarcharJdbcTypeDescriptor.java} | 6 +- ...a => LongVarbinaryJdbcTypeDescriptor.java} | 6 +- ...ava => LongVarcharJdbcTypeDescriptor.java} | 6 +- ...ptor.java => NCharJdbcTypeDescriptor.java} | 6 +- ...ptor.java => NClobJdbcTypeDescriptor.java} | 8 +- ...r.java => NVarcharJdbcTypeDescriptor.java} | 12 +- ...or.java => NumericJdbcTypeDescriptor.java} | 6 +- .../jdbc/ObjectJdbcTypeDescriptor.java | 4 +- ...ectNullAsBinaryTypeJdbcTypeDescriptor.java | 2 +- ...bjectNullAsNullTypeJdbcTypeDescriptor.java | 2 +- ...ObjectNullResolvingJdbcTypeDescriptor.java | 2 +- ...iptor.java => RealJdbcTypeDescriptor.java} | 14 +- ...r.java => SmallIntJdbcTypeDescriptor.java} | 12 +- ...iptor.java => TimeJdbcTypeDescriptor.java} | 12 +- ....java => TimestampJdbcTypeDescriptor.java} | 12 +- ...estampWithTimeZoneJdbcTypeDescriptor.java} | 12 +- ...or.java => TinyIntJdbcTypeDescriptor.java} | 12 +- ....java => VarbinaryJdbcTypeDescriptor.java} | 17 +- ...or.java => VarcharJdbcTypeDescriptor.java} | 14 +- .../internal/JdbcTypeDescriptorBaseline.java | 98 ++++++------ .../type/internal/StandardBasicTypeImpl.java | 6 +- .../internal/UserTypeJavaTypeWrapper.java | 4 +- .../type/internal/UserTypeSqlTypeAdapter.java | 10 +- .../basic/CollectionAsBasicTest.java | 8 +- .../lob/CharacterArrayTextType.java | 6 +- .../lob/PrimitiveCharacterArrayTextType.java | 6 +- .../lob/SerializableToImageType.java | 6 +- .../annotations/lob/WrappedImageType.java | 6 +- .../basics/CustomTypeResolutionTests.java | 13 +- .../annotations/basics/sql/JdbcTypeTests.java | 10 +- .../basics/sql/MapKeyJdbcTypeTests.java | 4 +- .../orm/test/immutable/ImmutableTest.java | 4 +- ...ativeQueryResultTypeAutoDiscoveryTest.java | 26 ++- .../converter/AttributeConverterTest.java | 4 +- .../custom/MyCustomJavaTypeDescriptor.java | 4 +- .../custom/MyCustomJdbcTypeDescriptor.java | 4 +- .../enums/TestEnumTypeSerialization.java | 15 +- .../type/java/BigDecimalDescriptorTest.java | 4 +- .../type/java/BigIntegerDescriptorTest.java | 4 +- .../mapping/type/java/BlobDescriptorTest.java | 18 +-- .../type/java/BooleanDescriptorTest.java | 4 +- ...ava => BooleanJavaTypeDescriptorTest.java} | 6 +- .../type/java/DurationDescriptorTest.java | 4 +- .../type/java/InstantDescriptorTest.java | 4 +- .../java/JavaTypeDescriptorRegistryTest.java | 4 +- ...va => JdbcTimeJavaTypeDescriptorTest.java} | 8 +- ... JdbcTimestampJavaTypeDescriptorTest.java} | 8 +- .../type/java/LocalDateDescriptorTest.java | 4 +- .../java/LocalDateTimeDescriptorTest.java | 4 +- .../type/java/LocalTimeDescriptorTest.java | 4 +- .../java/LocaleJavaTypeDescriptorTest.java | 52 ++++++ .../type/java/LocaleTypeDescriptorTest.java | 52 ------ .../java/OffsetDateTimeDescriptorTest.java | 4 +- .../type/java/OffsetTimeDescriptorTest.java | 4 +- .../PrimitiveByteArrayDescriptorTest.java | 10 +- .../type/java/StringDescriptorTest.java | 4 +- .../nationalized/SimpleNationalizedTest.java | 16 +- .../onetoone/formula/OneToOneFormulaTest.java | 4 +- .../QueryParametersValidationArrayTest.java | 4 +- .../orm/test/type/contributor/ArrayType.java | 15 +- .../type/contributor/ArrayTypeDescriptor.java | 4 +- .../sql/StringValueMappingTest.java | 12 +- ...ectOverridePrefixedVarcharSqlTypeDesc.java | 4 +- .../StoredPrefixedStringType.java | 16 +- .../test/typeoverride/TypeOverrideTest.java | 34 ++-- .../usertype/inet/InetJavaTypeDescriptor.java | 4 +- .../usertype/json/JsonJavaTypeDescriptor.java | 4 +- .../test/type/BasicTypeRegistryTest.java | 6 +- .../hibernate/test/type/LocalDateTest.java | 4 +- .../hibernate/test/type/LocalTimeTest.java | 4 +- .../type/LongListTypeContributorTest.java | 7 +- .../hibernate/test/type/OffsetTimeTest.java | 8 +- .../type/StandardBasicTypeTemplateTest.java | 14 +- .../GeolatteGeometryJavaTypeDescriptor.java | 4 +- .../JTSGeometryJavaTypeDescriptor.java | 4 +- .../dialect/oracle/SDOBooleanType.java | 53 ------- ...aDelimitedStringMapJavaTypeDescriptor.java | 4 +- ...mmaDelimitedStringsJavaTypeDescriptor.java | 4 +- .../CommaDelimitedStringsMapType.java | 6 +- .../CommaDelimitedStringsType.java | 6 +- 266 files changed, 1304 insertions(+), 2030 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableTemporalParameterType.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/type/DiscriminatorType.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/type/IdentifierType.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/type/PrimitiveType.java rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{AbstractClassTypeDescriptor.java => AbstractClassJavaTypeDescriptor.java} (88%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{AbstractTypeDescriptor.java => AbstractJavaTypeDescriptor.java} (89%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{AbstractTemporalTypeDescriptor.java => AbstractTemporalJavaTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{BasicJavaDescriptor.java => BasicJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{BigDecimalTypeDescriptor.java => BigDecimalJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{BigIntegerTypeDescriptor.java => BigIntegerJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{BlobTypeDescriptor.java => BlobJavaTypeDescriptor.java} (92%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{BooleanTypeDescriptor.java => BooleanJavaTypeDescriptor.java} (90%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ByteArrayTypeDescriptor.java => ByteArrayJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ByteTypeDescriptor.java => ByteJavaTypeDescriptor.java} (91%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CalendarDateTypeDescriptor.java => CalendarDateJavaTypeDescriptor.java} (83%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CalendarTypeDescriptor.java => CalendarJavaTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CalendarTimeTypeDescriptor.java => CalendarTimeJavaTypeDescriptor.java} (83%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CharacterArrayTypeDescriptor.java => CharacterArrayJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CharacterTypeDescriptor.java => CharacterJavaTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ClassTypeDescriptor.java => ClassJavaTypeDescriptor.java} (88%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ClobTypeDescriptor.java => ClobJavaTypeDescriptor.java} (96%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{CurrencyTypeDescriptor.java => CurrencyJavaTypeDescriptor.java} (84%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{DateTypeDescriptor.java => DateJavaTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{DoubleTypeDescriptor.java => DoubleJavaTypeDescriptor.java} (90%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{DurationJavaDescriptor.java => DurationJavaTypeDescriptor.java} (92%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{InstantJavaDescriptor.java => InstantJavaTypeDescriptor.java} (92%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{IntegerTypeDescriptor.java => IntegerJavaTypeDescriptor.java} (91%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{JdbcDateTypeDescriptor.java => JdbcDateJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{JdbcTimeTypeDescriptor.java => JdbcTimeJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{JdbcTimestampTypeDescriptor.java => JdbcTimestampJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{LocalDateJavaDescriptor.java => LocalDateJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{LocalDateTimeJavaDescriptor.java => LocalDateTimeJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{LocalTimeJavaDescriptor.java => LocalTimeJavaTypeDescriptor.java} (92%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{LocaleTypeDescriptor.java => LocaleJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{LongTypeDescriptor.java => LongJavaTypeDescriptor.java} (92%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{NClobTypeDescriptor.java => NClobJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ObjectArrayTypeDescriptor.java => ObjectArrayJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{JavaObjectTypeDescriptor.java => ObjectJavaTypeDescriptor.java} (75%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{OffsetDateTimeJavaDescriptor.java => OffsetDateTimeJavaTypeDescriptor.java} (91%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{OffsetTimeJavaDescriptor.java => OffsetTimeJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{PrimitiveByteArrayTypeDescriptor.java => PrimitiveByteArrayJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{PrimitiveCharacterArrayTypeDescriptor.java => PrimitiveCharacterArrayJavaTypeDescriptor.java} (90%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{RowVersionTypeDescriptor.java => RowVersionJavaTypeDescriptor.java} (94%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{SerializableTypeDescriptor.java => SerializableJavaTypeDescriptor.java} (88%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ShortTypeDescriptor.java => ShortJavaTypeDescriptor.java} (91%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{StringTypeDescriptor.java => StringJavaTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{TimeZoneTypeDescriptor.java => TimeZoneJavaTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{UUIDTypeDescriptor.java => UUIDJavaTypeDescriptor.java} (91%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{UrlTypeDescriptor.java => UrlJavaTypeDescriptor.java} (83%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/{ZoneOffsetJavaDescriptor.java => ZoneOffsetJavaTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/{Primitive.java => PrimitiveJavaTypeDescriptor.java} (84%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{BigIntTypeDescriptor.java => BigIntJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{BinaryTypeDescriptor.java => BinaryJdbcTypeDescriptor.java} (70%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{BlobTypeDescriptor.java => BlobJdbcTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{BooleanTypeDescriptor.java => BooleanJdbcTypeDescriptor.java} (88%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{CharTypeDescriptor.java => CharJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{ClobTypeDescriptor.java => ClobJdbcTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{DateTypeDescriptor.java => DateJdbcTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{DecimalTypeDescriptor.java => DecimalJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{DoubleTypeDescriptor.java => DoubleJdbcTypeDescriptor.java} (87%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{FloatTypeDescriptor.java => FloatJdbcTypeDescriptor.java} (84%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{IntegerTypeDescriptor.java => IntegerJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{LongNVarcharTypeDescriptor.java => LongNVarcharJdbcTypeDescriptor.java} (71%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{LongVarbinaryTypeDescriptor.java => LongVarbinaryJdbcTypeDescriptor.java} (68%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{LongVarcharTypeDescriptor.java => LongVarcharJdbcTypeDescriptor.java} (84%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{NCharTypeDescriptor.java => NCharJdbcTypeDescriptor.java} (73%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{NClobTypeDescriptor.java => NClobJdbcTypeDescriptor.java} (93%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{NVarcharTypeDescriptor.java => NVarcharJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{NumericTypeDescriptor.java => NumericJdbcTypeDescriptor.java} (73%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{RealTypeDescriptor.java => RealJdbcTypeDescriptor.java} (60%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{SmallIntTypeDescriptor.java => SmallIntJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{TimeTypeDescriptor.java => TimeJdbcTypeDescriptor.java} (89%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{TimestampTypeDescriptor.java => TimestampJdbcTypeDescriptor.java} (89%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{TimestampWithTimeZoneDescriptor.java => TimestampWithTimeZoneJdbcTypeDescriptor.java} (90%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{TinyIntTypeDescriptor.java => TinyIntJdbcTypeDescriptor.java} (86%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{VarbinaryTypeDescriptor.java => VarbinaryJdbcTypeDescriptor.java} (83%) rename hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/{VarcharTypeDescriptor.java => VarcharJdbcTypeDescriptor.java} (85%) rename hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/{BooleanTypeDescriptorTest.java => BooleanJavaTypeDescriptorTest.java} (87%) rename hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/{JdbcTimeTypeDescriptorTest.java => JdbcTimeJavaTypeDescriptorTest.java} (73%) rename hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/{JdbcTimestampTypeDescriptorTest.java => JdbcTimestampJavaTypeDescriptorTest.java} (71%) create mode 100644 hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/LocaleJavaTypeDescriptorTest.java delete mode 100644 hibernate-core/src/test/java/org/hibernate/orm/test/mapping/type/java/LocaleTypeDescriptorTest.java delete mode 100644 hibernate-spatial/src/main/java/org/hibernate/spatial/dialect/oracle/SDOBooleanType.java diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsJavaTypeDescriptor.java b/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsJavaTypeDescriptor.java index 010a3a8755..b875ca951e 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsJavaTypeDescriptor.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsJavaTypeDescriptor.java @@ -12,14 +12,14 @@ import java.util.stream.Collectors; import org.hibernate.type.descriptor.WrapperOptions; -import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor; +import org.hibernate.type.descriptor.java.AbstractClassJavaTypeDescriptor; import org.hibernate.type.descriptor.java.MutableMutabilityPlan; /** * @author Vlad Mihalcea */ //tag::collections-comma-delimited-collection-example[] -public class CommaDelimitedStringsJavaTypeDescriptor extends AbstractClassTypeDescriptor { +public class CommaDelimitedStringsJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor { public static final String DELIMITER = ","; diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsType.java b/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsType.java index e6039ce61a..bd25526668 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsType.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/type/CommaDelimitedStringsType.java @@ -9,7 +9,7 @@ import java.util.List; import org.hibernate.type.AbstractSingleColumnStandardBasicType; -import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.VarcharJdbcTypeDescriptor; /** * @author Vlad Mihalcea @@ -19,8 +19,8 @@ public class CommaDelimitedStringsType extends AbstractSingleColumnStandardBasic public CommaDelimitedStringsType() { super( - VarcharTypeDescriptor.INSTANCE, - new CommaDelimitedStringsJavaTypeDescriptor() + VarcharJdbcTypeDescriptor.INSTANCE, + new CommaDelimitedStringsJavaTypeDescriptor() ); } diff --git a/documentation/src/test/java/org/hibernate/userguide/collections/type/TimestampEpochType.java b/documentation/src/test/java/org/hibernate/userguide/collections/type/TimestampEpochType.java index 9554a43309..28db085113 100644 --- a/documentation/src/test/java/org/hibernate/userguide/collections/type/TimestampEpochType.java +++ b/documentation/src/test/java/org/hibernate/userguide/collections/type/TimestampEpochType.java @@ -8,10 +8,9 @@ import java.util.Date; -import org.hibernate.HibernateException; import org.hibernate.type.AbstractSingleColumnStandardBasicType; -import org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.BigIntTypeDescriptor; +import org.hibernate.type.descriptor.java.JdbcTimestampJavaTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.BigIntJdbcTypeDescriptor; /** * @author Vlad Mihalcea @@ -24,8 +23,8 @@ public class TimestampEpochType extends AbstractSingleColumnStandardBasicType { +public class BitSetJavaType extends AbstractClassJavaTypeDescriptor { public static final BitSetJavaType INSTANCE = new BitSetJavaType(); public BitSetJavaType() { diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BitSetType.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BitSetType.java index 778f89e57c..773c7f5028 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BitSetType.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/BitSetType.java @@ -3,29 +3,22 @@ import java.util.BitSet; import org.hibernate.type.AbstractSingleColumnStandardBasicType; -import org.hibernate.type.DiscriminatorType; -import org.hibernate.type.descriptor.jdbc.VarcharTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.VarcharJdbcTypeDescriptor; /** * @author Vlad Mihalcea */ //tag::basic-custom-type-BitSetType-example[] public class BitSetType - extends AbstractSingleColumnStandardBasicType - implements DiscriminatorType { + extends AbstractSingleColumnStandardBasicType { public static final BitSetType INSTANCE = new BitSetType(); public BitSetType() { - super( VarcharTypeDescriptor.INSTANCE, BitSetJavaType.INSTANCE ); + super( VarcharJdbcTypeDescriptor.INSTANCE, BitSetJavaType.INSTANCE ); } @Override - public BitSet stringToObject(CharSequence sequence) throws Exception { - return fromString( sequence ); - } - - @Override public String getName() { return "bitset"; } diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CustomBinaryJdbcType.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CustomBinaryJdbcType.java index 5aa4c373f3..be401a6c13 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CustomBinaryJdbcType.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/CustomBinaryJdbcType.java @@ -12,7 +12,7 @@ import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.VarbinaryTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.VarbinaryJdbcTypeDescriptor; /** * JdbcTypeDescriptor for documentation @@ -32,11 +32,11 @@ public boolean canBeRemapped() { @Override public ValueBinder getBinder(JavaTypeDescriptor javaTypeDescriptor) { - return VarbinaryTypeDescriptor.INSTANCE.getBinder( javaTypeDescriptor ); + return VarbinaryJdbcTypeDescriptor.INSTANCE.getBinder( javaTypeDescriptor ); } @Override public ValueExtractor getExtractor(JavaTypeDescriptor javaTypeDescriptor) { - return VarbinaryTypeDescriptor.INSTANCE.getExtractor( javaTypeDescriptor ); + return VarbinaryJdbcTypeDescriptor.INSTANCE.getExtractor( javaTypeDescriptor ); } } diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderJavaTypeDescriptor.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderJavaTypeDescriptor.java index 17555c645c..bda252a907 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderJavaTypeDescriptor.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderJavaTypeDescriptor.java @@ -1,14 +1,14 @@ package org.hibernate.userguide.mapping.basic; import org.hibernate.type.descriptor.WrapperOptions; -import org.hibernate.type.descriptor.java.AbstractClassTypeDescriptor; -import org.hibernate.type.descriptor.java.CharacterTypeDescriptor; +import org.hibernate.type.descriptor.java.AbstractClassJavaTypeDescriptor; +import org.hibernate.type.descriptor.java.CharacterJavaTypeDescriptor; /** * @author Vlad Mihalcea */ //tag::basic-enums-custom-type-example[] -public class GenderJavaTypeDescriptor extends AbstractClassTypeDescriptor { +public class GenderJavaTypeDescriptor extends AbstractClassJavaTypeDescriptor { public static final GenderJavaTypeDescriptor INSTANCE = new GenderJavaTypeDescriptor(); @@ -26,7 +26,7 @@ public Gender fromString(CharSequence string) { } public X unwrap(Gender value, Class type, WrapperOptions options) { - return CharacterTypeDescriptor.INSTANCE.unwrap( + return CharacterJavaTypeDescriptor.INSTANCE.unwrap( value == null ? null : value.getCode(), type, options @@ -35,7 +35,7 @@ public X unwrap(Gender value, Class type, WrapperOptions options) { public Gender wrap(X value, WrapperOptions options) { return Gender.fromCode( - CharacterTypeDescriptor.INSTANCE.wrap( value, options ) + CharacterJavaTypeDescriptor.INSTANCE.wrap( value, options ) ); } } diff --git a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderType.java b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderType.java index 0f08fae202..695fb5e226 100644 --- a/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderType.java +++ b/documentation/src/test/java/org/hibernate/userguide/mapping/basic/GenderType.java @@ -1,7 +1,7 @@ package org.hibernate.userguide.mapping.basic; import org.hibernate.type.AbstractSingleColumnStandardBasicType; -import org.hibernate.type.descriptor.jdbc.CharTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.CharJdbcTypeDescriptor; /** * @author Vlad Mihalcea @@ -13,8 +13,8 @@ public class GenderType extends AbstractSingleColumnStandardBasicType { public GenderType() { super( - CharTypeDescriptor.INSTANCE, - GenderJavaTypeDescriptor.INSTANCE + CharJdbcTypeDescriptor.INSTANCE, + GenderJavaTypeDescriptor.INSTANCE ); } diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java index 5cb0bfe508..d6de9a3259 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SQLiteDialect.java @@ -49,8 +49,8 @@ import org.hibernate.sql.ast.tree.Statement; import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.BlobJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.ClobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate; @@ -319,9 +319,9 @@ protected boolean supportsMathFunctions() { public JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { switch (sqlCode) { case Types.BLOB: - return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; + return BlobJdbcTypeDescriptor.PRIMITIVE_ARRAY_BINDING; case Types.CLOB: - return ClobTypeDescriptor.STRING_BINDING; + return ClobJdbcTypeDescriptor.STRING_BINDING; default: return super.getSqlTypeDescriptorOverride( sqlCode ); } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/JavaType.java b/hibernate-core/src/main/java/org/hibernate/annotations/JavaType.java index a4d1d4940a..68aaa3e446 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/JavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/JavaType.java @@ -9,7 +9,7 @@ import java.lang.annotation.Inherited; import java.lang.annotation.Retention; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.FIELD; @@ -30,5 +30,5 @@ /** * The JavaTypeDescriptor to use */ - Class> value(); + Class> value(); } diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/JavaTypeRegistration.java b/hibernate-core/src/main/java/org/hibernate/annotations/JavaTypeRegistration.java index 2b07845673..dda53f25f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/JavaTypeRegistration.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/JavaTypeRegistration.java @@ -10,7 +10,7 @@ import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.PACKAGE; @@ -31,5 +31,5 @@ public @interface JavaTypeRegistration { Class javaType(); - Class> descriptorClass(); + Class> descriptorClass(); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistry.java b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistry.java index d08676d80c..e07fc3a1b3 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistry.java @@ -8,7 +8,7 @@ import java.util.Map; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; /** * @author Chris Cranford @@ -23,7 +23,7 @@ enum DuplicationStrategy { } TypeDefinition resolve(String typeName); - TypeDefinition resolveAutoApplied(BasicJavaDescriptor jtd); + TypeDefinition resolveAutoApplied(BasicJavaTypeDescriptor jtd); TypeDefinitionRegistry register(TypeDefinition typeDefinition); TypeDefinitionRegistry register(TypeDefinition typeDefinition, DuplicationStrategy duplicationStrategy); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java index 091b0a2b6d..c090d594db 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java @@ -11,7 +11,7 @@ import java.util.Map; import org.hibernate.internal.util.StringHelper; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.jboss.logging.Logger; @@ -47,7 +47,7 @@ public TypeDefinition resolve(String typeName) { } @Override - public TypeDefinition resolveAutoApplied(BasicJavaDescriptor jtd) { + public TypeDefinition resolveAutoApplied(BasicJavaTypeDescriptor jtd) { // For now, check the definition map for a entry keyed by the JTD name. // Ultimately should maybe have TypeDefinition or the registry keep explicit track of // auto-applied defs diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java index e68560f92f..37d38ecc45 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/InferredBasicValueResolver.java @@ -21,21 +21,20 @@ import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.model.convert.internal.NamedEnumValueConverter; import org.hibernate.metamodel.model.convert.internal.OrdinalEnumValueConverter; -import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.type.AdjustableBasicType; import org.hibernate.type.BasicType; import org.hibernate.type.CustomType; import org.hibernate.type.SerializableType; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.EnumJavaTypeDescriptor; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; -import org.hibernate.type.descriptor.java.SerializableTypeDescriptor; +import org.hibernate.type.descriptor.java.SerializableJavaTypeDescriptor; import org.hibernate.type.descriptor.java.TemporalJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators; import org.hibernate.type.descriptor.jdbc.ObjectJdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.TinyIntJdbcTypeDescriptor; import org.hibernate.type.spi.TypeConfiguration; /** @@ -48,7 +47,7 @@ public class InferredBasicValueResolver { */ @SuppressWarnings({"unchecked", "rawtypes"}) public static BasicValue.Resolution from( - Function explicitJavaTypeAccess, + Function explicitJavaTypeAccess, Function explicitSqlTypeAccess, Type resolvedJavaType, Supplier reflectedJtdResolver, @@ -59,10 +58,10 @@ public static BasicValue.Resolution from( String propertyName, TypeConfiguration typeConfiguration) { - final BasicJavaDescriptor explicitJavaType = explicitJavaTypeAccess != null ? explicitJavaTypeAccess.apply( typeConfiguration ) : null; + final BasicJavaTypeDescriptor explicitJavaType = explicitJavaTypeAccess != null ? explicitJavaTypeAccess.apply( typeConfiguration ) : null; final JdbcTypeDescriptor explicitJdbcType = explicitSqlTypeAccess != null ? explicitSqlTypeAccess.apply( typeConfiguration ) : null; - final BasicJavaDescriptor reflectedJtd = (BasicJavaDescriptor) reflectedJtdResolver.get(); + final BasicJavaTypeDescriptor reflectedJtd = (BasicJavaTypeDescriptor) reflectedJtdResolver.get(); // NOTE : the distinction that is made below wrt `explicitJavaType` and `reflectedJtd` is // needed temporarily to trigger "legacy resolution" versus "ORM6 resolution. Yes, it @@ -108,7 +107,7 @@ else if ( explicitJavaType instanceof TemporalJavaTypeDescriptor ) { typeConfiguration ); } - else if ( explicitJavaType instanceof SerializableTypeDescriptor || explicitJavaType.getJavaType() instanceof Serializable ) { + else if ( explicitJavaType instanceof SerializableJavaTypeDescriptor || explicitJavaType.getJavaType() instanceof Serializable ) { legacyType = new SerializableType<>( explicitJavaType ); jdbcMapping = legacyType; } @@ -172,7 +171,7 @@ else if ( reflectedJtd instanceof TemporalJavaTypeDescriptor ) { legacyType = resolveSqlTypeIndicators( stdIndicators, registeredType, reflectedJtd ); jdbcMapping = legacyType; } - else if ( reflectedJtd instanceof SerializableTypeDescriptor || reflectedJtd.getJavaType() instanceof Serializable ) { + else if ( reflectedJtd instanceof SerializableJavaTypeDescriptor || reflectedJtd.getJavaType() instanceof Serializable ) { legacyType = new SerializableType<>( reflectedJtd ); jdbcMapping = legacyType; } @@ -205,7 +204,7 @@ else if ( column.getLength() != null ) { } } } - final BasicJavaDescriptor recommendedJtd = explicitJdbcType.getJdbcRecommendedJavaTypeMapping( + final BasicJavaTypeDescriptor recommendedJtd = explicitJdbcType.getJdbcRecommendedJavaTypeMapping( length, scale, typeConfiguration @@ -269,7 +268,7 @@ public static BasicType resolveSqlTypeIndicators( @SuppressWarnings("rawtypes") public static InferredBasicValueResolution fromEnum( EnumJavaTypeDescriptor enumJavaDescriptor, - BasicJavaDescriptor explicitJavaType, + BasicJavaTypeDescriptor explicitJavaType, JdbcTypeDescriptor explicitJdbcType, JdbcTypeDescriptorIndicators stdIndicators, TypeConfiguration typeConfiguration) { @@ -344,7 +343,7 @@ public static InferredBasicValueResolution fromEnum( relationalJtd = typeConfiguration.getJavaTypeDescriptorRegistry().getDescriptor( Integer.class ); } - final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : TinyIntTypeDescriptor.INSTANCE; + final JdbcTypeDescriptor jdbcTypeDescriptor = explicitJdbcType != null ? explicitJdbcType : TinyIntJdbcTypeDescriptor.INSTANCE; //noinspection unchecked final OrdinalEnumValueConverter valueConverter = new OrdinalEnumValueConverter( @@ -384,7 +383,7 @@ public static InferredBasicValueResolution fromEnum( @SuppressWarnings({"rawtypes", "unchecked"}) public static InferredBasicValueResolution fromTemporal( TemporalJavaTypeDescriptor reflectedJtd, - BasicJavaDescriptor explicitJavaType, + BasicJavaTypeDescriptor explicitJavaType, JdbcTypeDescriptor explicitJdbcType, Type resolvedJavaType, JdbcTypeDescriptorIndicators stdIndicators, @@ -464,27 +463,17 @@ public static InferredBasicValueResolution fromTemporal( // // - for the moment continue to use the legacy resolution to registered // BasicType - final Type javaType; - if ( resolvedJavaType == null ) { - javaType = reflectedJtd.getJavaType(); - } - else { - javaType = resolvedJavaType; - } - final BasicType registeredType = typeConfiguration.getBasicTypeRegistry().getRegisteredType( javaType ); - final AllowableTemporalParameterType legacyTemporalType = (AllowableTemporalParameterType) registeredType; - final BasicType basicType; - if ( requestedTemporalPrecision != null ) { - basicType = (BasicType) legacyTemporalType.resolveTemporalPrecision( - requestedTemporalPrecision, - typeConfiguration + if ( requestedTemporalPrecision != null && requestedTemporalPrecision != reflectedJtd.getPrecision() ) { + basicType = typeConfiguration.getBasicTypeRegistry().resolve( + reflectedJtd.resolveTypeForPrecision( requestedTemporalPrecision, typeConfiguration ), + TemporalJavaTypeDescriptor.resolveJdbcTypeCode( requestedTemporalPrecision ) ); } else { - basicType = (BasicType) legacyTemporalType.resolveTemporalPrecision( - reflectedJtd.getPrecision(), - typeConfiguration + basicType = typeConfiguration.getBasicTypeRegistry().resolve( + reflectedJtd, + reflectedJtd.getRecommendedJdbcType( stdIndicators ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java index cb49823700..560df92c9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java @@ -21,7 +21,7 @@ import org.hibernate.type.BasicType; import org.hibernate.type.descriptor.converter.AttributeConverterMutabilityPlanImpl; import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.MutabilityPlan; @@ -37,7 +37,7 @@ public class NamedConverterResolution implements BasicValue.Resolution { public static NamedConverterResolution from( ConverterDescriptor converterDescriptor, - Function explicitJtdAccess, + Function explicitJtdAccess, Function explicitStdAccess, Function explicitMutabilityPlanAccess, JdbcTypeDescriptorIndicators sqlTypeIndicators, @@ -55,7 +55,7 @@ public static NamedConverterResolution from( public static NamedConverterResolution from( String name, - Function explicitJtdAccess, + Function explicitJtdAccess, Function explicitStdAccess, Function explicitMutabilityPlanAccess, JdbcTypeDescriptorIndicators sqlTypeIndicators, @@ -84,7 +84,7 @@ public static NamedConverterResolution from( } private static NamedConverterResolution fromInternal( - Function explicitJtdAccess, + Function explicitJtdAccess, Function explicitStdAccess, Function explicitMutabilityPlanAccess, JpaAttributeConverter converter, JdbcTypeDescriptorIndicators sqlTypeIndicators, diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/VersionResolution.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/VersionResolution.java index b85dce92d6..c3986f1cfa 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/VersionResolution.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/VersionResolution.java @@ -15,11 +15,11 @@ import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.type.BasicType; import org.hibernate.type.RowVersionType; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.MutabilityPlan; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptorIndicators; import org.hibernate.type.spi.TypeConfiguration; @@ -36,7 +36,7 @@ public class VersionResolution implements BasicValue.Resolution { @SuppressWarnings({"rawtypes", "unchecked"}) public static VersionResolution from( Function implicitJavaTypeAccess, - Function explicitJtdAccess, + Function explicitJtdAccess, Function explicitStdAccess, TypeConfiguration typeConfiguration, @SuppressWarnings("unused") MetadataBuildingContext context) { @@ -46,7 +46,7 @@ public static VersionResolution from( final java.lang.reflect.Type implicitJavaType = implicitJavaTypeAccess.apply( typeConfiguration ); final JavaTypeDescriptor registered = typeConfiguration.getJavaTypeDescriptorRegistry().resolveDescriptor( implicitJavaType ); - if ( registered instanceof PrimitiveByteArrayTypeDescriptor ) { + if ( registered instanceof PrimitiveByteArrayJavaTypeDescriptor ) { return new VersionResolution<>( RowVersionType.INSTANCE.getJavaTypeDescriptor(), RowVersionType.INSTANCE.getJdbcTypeDescriptor(), @@ -55,7 +55,7 @@ public static VersionResolution from( ); } - final BasicJavaDescriptor jtd = (BasicJavaDescriptor) registered; + final BasicJavaTypeDescriptor jtd = (BasicJavaTypeDescriptor) registered; final JdbcTypeDescriptor recommendedJdbcType = jtd.getRecommendedJdbcType( new JdbcTypeDescriptorIndicators() { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java index 3eb448b0c6..72e8086fed 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java @@ -155,7 +155,6 @@ import org.hibernate.type.ClobType; import org.hibernate.type.ComponentType; import org.hibernate.type.CustomType; -import org.hibernate.type.DiscriminatorType; import org.hibernate.type.ForeignKeyDirection; import org.hibernate.type.NClobType; import org.hibernate.type.StandardBasicTypes; @@ -2396,7 +2395,7 @@ private void bindAny( ); final String discriminatorTypeName; - final DiscriminatorType discriminatorType; + final BasicType discriminatorType; if ( discriminatorTypeResolution != null && discriminatorTypeResolution.typeName != null ) { discriminatorTypeName = discriminatorTypeResolution.typeName; discriminatorType = resolveExplicitlyNamedAnyDiscriminatorType( @@ -2417,7 +2416,7 @@ private void bindAny( anyMapping.getDiscriminatorSource().getValueMappings().forEach( (discriminatorValueString, entityName) -> { try { - final Object discriminatorValue = discriminatorType.stringToObject( discriminatorValueString ); + final Object discriminatorValue = discriminatorType.getJavaTypeDescriptor().fromString( discriminatorValueString ); discriminatorValueToEntityNameMap.put( discriminatorValue, entityName ); } catch (Exception e) { @@ -2458,7 +2457,7 @@ private void bindAny( ); } - private DiscriminatorType resolveExplicitlyNamedAnyDiscriminatorType( + private BasicType resolveExplicitlyNamedAnyDiscriminatorType( String typeName, Properties parameters, Any.MetaValue discriminatorMapping) { @@ -2471,7 +2470,7 @@ private DiscriminatorType resolveExplicitlyNamedAnyDiscriminatorType( .getBasicTypeRegistry() .getRegisteredType( typeName ); if ( basicTypeByName != null ) { - return (DiscriminatorType) basicTypeByName; + return basicTypeByName; } } @@ -2489,7 +2488,7 @@ private DiscriminatorType resolveExplicitlyNamedAnyDiscriminatorType( discriminatorMapping.setTypeParameters( resolution.getCombinedTypeParameters() ); } - return (DiscriminatorType) resolution.getLegacyResolvedBasicType(); + return resolution.getLegacyResolvedBasicType(); } final ClassLoaderService classLoaderService = bootstrapContext @@ -2520,7 +2519,7 @@ private DiscriminatorType resolveExplicitlyNamedAnyDiscriminatorType( } assert typeInstance instanceof BasicType; - return (DiscriminatorType) typeInstance; + return (BasicType) typeInstance; } catch (ClassLoadingException e) { log.debugf( "Unable to load explicit any-discriminator type name as Java Class - %s", typeName ); diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java index 588ead5e82..11007ef9d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -73,7 +73,6 @@ import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; -import org.hibernate.EntityMode; import org.hibernate.FetchMode; import org.hibernate.MappingException; import org.hibernate.annotations.BatchSize; @@ -171,7 +170,7 @@ import org.hibernate.mapping.ToOne; import org.hibernate.mapping.UnionSubclass; import org.hibernate.resource.beans.spi.ManagedBeanRegistry; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import static org.hibernate.internal.CoreLogging.messageLogger; @@ -372,8 +371,8 @@ private static void handleJavaTypeDescriptorRegistration( MetadataBuildingContext context, ManagedBeanRegistry managedBeanRegistry, JavaTypeRegistration annotation) { - final Class> jtdClass = annotation.descriptorClass(); - final BasicJavaDescriptor jtd = managedBeanRegistry.getBean( jtdClass ).getBeanInstance(); + final Class> jtdClass = annotation.descriptorClass(); + final BasicJavaTypeDescriptor jtd = managedBeanRegistry.getBean( jtdClass ).getBeanInstance(); context.getMetadataCollector().addJavaTypeRegistration( annotation.javaType(), jtd ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java index 7a6fcc79a8..5bcde66c22 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java @@ -60,7 +60,7 @@ import org.hibernate.mapping.Table; import org.hibernate.mapping.ToOne; import org.hibernate.mapping.Value; -import org.hibernate.type.DiscriminatorType; +import org.hibernate.type.BasicType; import org.jboss.logging.Logger; @@ -981,7 +981,7 @@ public static Any buildAnyValue( value.setMetaType( metaDefToUse.metaType() ); final HashMap values = new HashMap<>(); - final DiscriminatorType metaType = (DiscriminatorType) context.getMetadataCollector() + final BasicType metaType = context.getMetadataCollector() .getTypeConfiguration() .getBasicTypeRegistry() .getRegisteredType( value.getMetaType() ); @@ -989,7 +989,7 @@ public static Any buildAnyValue( for (int i = 0; i < metaDefToUse.metaValues().length; i++) { final MetaValue metaValue = metaDefToUse.metaValues()[ i ]; try { - final Object discriminator = metaType.stringToObject( metaValue.value() ); + final Object discriminator = metaType.getJavaTypeDescriptor().fromString( metaValue.value() ); final String entityName = metaValue.targetEntity().getName(); values.put( discriminator, entityName ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java index 219e98a1d0..2d84c27d76 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/BasicValueBinder.java @@ -60,7 +60,7 @@ import org.hibernate.mapping.Table; import org.hibernate.type.BasicType; import org.hibernate.type.SerializableToBlobType; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan; import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; @@ -105,7 +105,7 @@ public enum Kind { private Map explicitLocalTypeParams; private Function explicitSqlTypeAccess; - private Function explicitJtdAccess; + private Function explicitJtdAccess; private Function explicitMutabilityAccess; private Function implicitJavaTypeAccess; @@ -545,7 +545,7 @@ private void mapKeySupplementalDetails(XProperty attributeXProperty) { } final JavaType jtdAnn = mapKeyJtdAnn.value(); - final Class> jtdJavaType = jtdAnn.value(); + final Class> jtdJavaType = jtdAnn.value(); try { return jtdJavaType.newInstance(); } @@ -583,7 +583,7 @@ private void normalSupplementalDetails( explicitJtdAccess = typeConfiguration -> { final JavaType explicitJtdAnn = attributeXProperty.getAnnotation( JavaType.class ); if ( explicitJtdAnn != null ) { - final Class> jtdImplJavaType = explicitJtdAnn.value(); + final Class> jtdImplJavaType = explicitJtdAnn.value(); try { return jtdImplJavaType.newInstance(); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java index f65ce72d79..8c7a06d991 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java @@ -57,6 +57,7 @@ import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.WrapperOptions; import org.hibernate.type.descriptor.java.DataHelper; +import org.hibernate.type.descriptor.java.DoubleJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.*; import org.hibernate.type.internal.StandardBasicTypeImpl; @@ -387,7 +388,7 @@ protected X doExtract(CallableStatement statement, String name, WrapperOptions o // using non-contextual lob creation and HANA then closes our StringReader. // see test case LobLocatorTest - private static class HANAClobTypeDescriptor extends ClobTypeDescriptor { + private static class HANAClobJdbcTypeDescriptor extends ClobJdbcTypeDescriptor { @Override public String toString() { return "HANAClobTypeDescriptor"; @@ -399,7 +400,7 @@ public String toString() { final int maxLobPrefetchSize; final boolean useUnicodeStringTypes; - public HANAClobTypeDescriptor(int maxLobPrefetchSize, boolean useUnicodeStringTypes) { + public HANAClobJdbcTypeDescriptor(int maxLobPrefetchSize, boolean useUnicodeStringTypes) { this.maxLobPrefetchSize = maxLobPrefetchSize; this.useUnicodeStringTypes = useUnicodeStringTypes; } @@ -452,14 +453,14 @@ public ValueExtractor getExtractor(JavaTypeDescriptor javaTypeDescript @Override protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException { Clob rsClob; - if ( HANAClobTypeDescriptor.this.useUnicodeStringTypes ) { + if ( HANAClobJdbcTypeDescriptor.this.useUnicodeStringTypes ) { rsClob = rs.getNClob( paramIndex ); } else { rsClob = rs.getClob( paramIndex ); } - if ( rsClob == null || rsClob.length() < HANAClobTypeDescriptor.this.maxLobPrefetchSize ) { + if ( rsClob == null || rsClob.length() < HANAClobJdbcTypeDescriptor.this.maxLobPrefetchSize ) { return javaTypeDescriptor.wrap( rsClob, options ); } Clob clob = new MaterializedNClob( DataHelper.extractString( rsClob ) ); @@ -487,14 +488,14 @@ public boolean isUseUnicodeStringTypes() { } } - private static class HANANClobTypeDescriptor extends NClobTypeDescriptor { + private static class HANANClobJdbcTypeDescriptor extends NClobJdbcTypeDescriptor { /** serial version uid. */ private static final long serialVersionUID = 5651116091681647859L; final int maxLobPrefetchSize; - public HANANClobTypeDescriptor(int maxLobPrefetchSize) { + public HANANClobJdbcTypeDescriptor(int maxLobPrefetchSize) { this.maxLobPrefetchSize = maxLobPrefetchSize; } @@ -551,7 +552,7 @@ public ValueExtractor getExtractor(JavaTypeDescriptor javaTypeDescript @Override protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException { NClob rsNClob = rs.getNClob( paramIndex ); - if ( rsNClob == null || rsNClob.length() < HANANClobTypeDescriptor.this.maxLobPrefetchSize ) { + if ( rsNClob == null || rsNClob.length() < HANANClobJdbcTypeDescriptor.this.maxLobPrefetchSize ) { return javaTypeDescriptor.wrap( rsNClob, options ); } NClob nClob = new MaterializedNClob( DataHelper.extractString( rsNClob ) ); @@ -640,10 +641,10 @@ public BasicBinder getBinder(final JavaTypeDescriptor javaTypeDescript @Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { - JdbcTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING; + JdbcTypeDescriptor descriptor = BlobJdbcTypeDescriptor.BLOB_BINDING; if ( byte[].class.isInstance( value ) ) { // performance shortcut for binding BLOB data in byte[] format - descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; + descriptor = BlobJdbcTypeDescriptor.PRIMITIVE_ARRAY_BINDING; } else if ( options.useStreamForLobBinding() ) { descriptor = HANABlobTypeDescriptor.this.hanaStreamBlobTypeDescriptor; @@ -653,10 +654,10 @@ else if ( options.useStreamForLobBinding() ) { @Override protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) throws SQLException { - JdbcTypeDescriptor descriptor = BlobTypeDescriptor.BLOB_BINDING; + JdbcTypeDescriptor descriptor = BlobJdbcTypeDescriptor.BLOB_BINDING; if ( byte[].class.isInstance( value ) ) { // performance shortcut for binding BLOB data in byte[] format - descriptor = BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; + descriptor = BlobJdbcTypeDescriptor.PRIMITIVE_ARRAY_BINDING; } else if ( options.useStreamForLobBinding() ) { descriptor = HANABlobTypeDescriptor.this.hanaStreamBlobTypeDescriptor; @@ -686,11 +687,11 @@ public int getMaxLobPrefetchSize() { private static final Boolean USE_LEGACY_BOOLEAN_TYPE_DEFAULT_VALUE = Boolean.FALSE; private static final Boolean TREAT_DOUBLE_TYPED_FIELDS_AS_DECIMAL_DEFAULT_VALUE = Boolean.FALSE; - private HANANClobTypeDescriptor nClobTypeDescriptor = new HANANClobTypeDescriptor( MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE ); + private HANANClobJdbcTypeDescriptor nClobTypeDescriptor = new HANANClobJdbcTypeDescriptor( MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE ); private HANABlobTypeDescriptor blobTypeDescriptor = new HANABlobTypeDescriptor( MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE ); - private HANAClobTypeDescriptor clobTypeDescriptor; + private HANAClobJdbcTypeDescriptor clobTypeDescriptor; private boolean useLegacyBooleanType = USE_LEGACY_BOOLEAN_TYPE_DEFAULT_VALUE.booleanValue(); private boolean useUnicodeStringTypes; @@ -741,8 +742,10 @@ public AbstractHANADialect() { super(); this.useUnicodeStringTypes = useUnicodeStringTypesDefault().booleanValue(); - this.clobTypeDescriptor = new HANAClobTypeDescriptor( MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE, - useUnicodeStringTypesDefault().booleanValue() ); + this.clobTypeDescriptor = new HANAClobJdbcTypeDescriptor( + MAX_LOB_PREFETCH_SIZE_DEFAULT_VALUE, + useUnicodeStringTypesDefault().booleanValue() + ); // Note that 38 is the maximum precision HANA supports registerColumnType( Types.DECIMAL, "decimal($p, $s)" ); @@ -1035,13 +1038,13 @@ protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(final int sqlCode) { return this.blobTypeDescriptor; case Types.TINYINT: // tinyint is unsigned on HANA - return SmallIntTypeDescriptor.INSTANCE; + return SmallIntJdbcTypeDescriptor.INSTANCE; case Types.VARCHAR: - return this.isUseUnicodeStringTypes() ? NVarcharTypeDescriptor.INSTANCE : VarcharTypeDescriptor.INSTANCE; + return this.isUseUnicodeStringTypes() ? NVarcharJdbcTypeDescriptor.INSTANCE : VarcharJdbcTypeDescriptor.INSTANCE; case Types.CHAR: - return this.isUseUnicodeStringTypes() ? NCharTypeDescriptor.INSTANCE : CharTypeDescriptor.INSTANCE; + return this.isUseUnicodeStringTypes() ? NCharJdbcTypeDescriptor.INSTANCE : CharJdbcTypeDescriptor.INSTANCE; case Types.DOUBLE: - return this.treatDoubleTypedFieldsAsDecimal ? DecimalTypeDescriptor.INSTANCE : DoubleTypeDescriptor.INSTANCE; + return this.treatDoubleTypedFieldsAsDecimal ? DecimalJdbcTypeDescriptor.INSTANCE : DoubleJdbcTypeDescriptor.INSTANCE; default: return super.getSqlTypeDescriptorOverride( sqlCode ); } @@ -1429,7 +1432,7 @@ public Integer convert(Object value) { Integer.valueOf( maxLobPrefetchSizeDefault ) ).intValue(); if ( this.nClobTypeDescriptor.getMaxLobPrefetchSize() != maxLobPrefetchSize ) { - this.nClobTypeDescriptor = new HANANClobTypeDescriptor( maxLobPrefetchSize ); + this.nClobTypeDescriptor = new HANANClobJdbcTypeDescriptor( maxLobPrefetchSize ); } if ( this.blobTypeDescriptor.getMaxLobPrefetchSize() != maxLobPrefetchSize ) { @@ -1454,7 +1457,7 @@ public Integer convert(Object value) { if ( this.clobTypeDescriptor.getMaxLobPrefetchSize() != maxLobPrefetchSize || this.clobTypeDescriptor.isUseUnicodeStringTypes() != this.useUnicodeStringTypes ) { - this.clobTypeDescriptor = new HANAClobTypeDescriptor( maxLobPrefetchSize, this.useUnicodeStringTypes ); + this.clobTypeDescriptor = new HANAClobJdbcTypeDescriptor( maxLobPrefetchSize, this.useUnicodeStringTypes ); } } @@ -1475,8 +1478,8 @@ public Integer convert(Object value) { typeContributions.getTypeConfiguration().getBasicTypeRegistry() .register( new StandardBasicTypeImpl<>( - org.hibernate.type.descriptor.java.DoubleTypeDescriptor.INSTANCE, - NumericTypeDescriptor.INSTANCE + DoubleJavaTypeDescriptor.INSTANCE, + NumericJdbcTypeDescriptor.INSTANCE ), Double.class.getName() ); @@ -1500,15 +1503,15 @@ public Integer convert(Object value) { .add( StandardBasicTypes.BIG_DECIMAL.getName() ); typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( Types.FLOAT, - NumericTypeDescriptor.INSTANCE + NumericJdbcTypeDescriptor.INSTANCE ); typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( Types.REAL, - NumericTypeDescriptor.INSTANCE + NumericJdbcTypeDescriptor.INSTANCE ); typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( Types.DOUBLE, - NumericTypeDescriptor.INSTANCE + NumericJdbcTypeDescriptor.INSTANCE ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java index 3539f98063..8d635d9b4d 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java @@ -26,7 +26,7 @@ import org.hibernate.query.sqm.mutation.internal.idtable.TempIdTableExporter; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.sql.ast.spi.SqlAppender; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry; @@ -314,6 +314,6 @@ public boolean supportsPartitionBy() { @Override public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "0x" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java index 21a2c77d8c..fe037ad884 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DB2Dialect.java @@ -44,7 +44,7 @@ import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.type.JavaObjectType; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.*; import java.sql.CallableStatement; @@ -502,15 +502,15 @@ protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { final int version = getVersion(); if ( version < 1100 && sqlCode == Types.BOOLEAN ) { - return SmallIntTypeDescriptor.INSTANCE; + return SmallIntJdbcTypeDescriptor.INSTANCE; } else if ( version < 1100 && sqlCode == Types.VARBINARY ) { // Binary literals were only added in 11. See https://www.ibm.com/support/knowledgecenter/SSEPGG_11.1.0/com.ibm.db2.luw.sql.ref.doc/doc/r0000731.html#d79816e393 - return VarbinaryTypeDescriptor.INSTANCE_WITHOUT_LITERALS; + return VarbinaryJdbcTypeDescriptor.INSTANCE_WITHOUT_LITERALS; } else if ( version < 970 ) { return sqlCode == Types.NUMERIC - ? DecimalTypeDescriptor.INSTANCE + ? DecimalJdbcTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride(sqlCode); } else { @@ -521,15 +521,15 @@ else if ( version < 970 ) { // use the non-N variants which are supported. switch ( sqlCode ) { case Types.NCHAR: - return CharTypeDescriptor.INSTANCE; + return CharJdbcTypeDescriptor.INSTANCE; case Types.NCLOB: return useInputStreamToInsertBlob() - ? ClobTypeDescriptor.STREAM_BINDING - : ClobTypeDescriptor.CLOB_BINDING; + ? ClobJdbcTypeDescriptor.STREAM_BINDING + : ClobJdbcTypeDescriptor.CLOB_BINDING; case Types.NVARCHAR: - return VarcharTypeDescriptor.INSTANCE; + return VarcharJdbcTypeDescriptor.INSTANCE; case Types.NUMERIC: - return DecimalTypeDescriptor.INSTANCE; + return DecimalJdbcTypeDescriptor.INSTANCE; default: return super.getSqlTypeDescriptorOverride(sqlCode); } @@ -557,7 +557,7 @@ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry @Override public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "BX'" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); appender.appendSql( '\'' ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java index 4a9bfe80c0..a18fa6ac0c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DerbyDialect.java @@ -55,11 +55,11 @@ import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor; import org.hibernate.type.JavaObjectType; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.jdbc.DecimalTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.DecimalJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ObjectNullResolvingJdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.TimestampTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.SmallIntJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.TimestampJdbcTypeDescriptor; import java.sql.DatabaseMetaData; import java.sql.SQLException; @@ -494,13 +494,13 @@ public boolean supportsOrderByInSubquery() { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { if ( getVersion() < 1070 && sqlCode == Types.BOOLEAN) { - return SmallIntTypeDescriptor.INSTANCE; + return SmallIntJdbcTypeDescriptor.INSTANCE; } switch ( sqlCode ) { case Types.NUMERIC: - return DecimalTypeDescriptor.INSTANCE; + return DecimalJdbcTypeDescriptor.INSTANCE; case Types.TIMESTAMP_WITH_TIMEZONE: - return TimestampTypeDescriptor.INSTANCE; + return TimestampJdbcTypeDescriptor.INSTANCE; default: return super.getSqlTypeDescriptorOverride(sqlCode); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index d8f6f2a77a..06267f5693 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -9,7 +9,6 @@ import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.LockOptions; -import org.hibernate.MappingException; import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.dialect.sequence.NoSequenceSupport; import org.hibernate.query.FetchClauseType; @@ -77,13 +76,13 @@ import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.Type; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.ClobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.LongNVarcharTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.NCharTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.NClobTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.NVarcharTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.LongNVarcharJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.NCharJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.NClobJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.NVarcharJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry; import jakarta.persistence.TemporalType; @@ -984,10 +983,10 @@ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry final NationalizationSupport nationalizationSupport = getNationalizationSupport(); if ( nationalizationSupport == NationalizationSupport.EXPLICIT ) { - typeContributions.contributeJdbcTypeDescriptor( NCharTypeDescriptor.INSTANCE ); - typeContributions.contributeJdbcTypeDescriptor( NVarcharTypeDescriptor.INSTANCE ); - typeContributions.contributeJdbcTypeDescriptor( LongNVarcharTypeDescriptor.INSTANCE ); - typeContributions.contributeJdbcTypeDescriptor( NClobTypeDescriptor.DEFAULT ); + typeContributions.contributeJdbcTypeDescriptor( NCharJdbcTypeDescriptor.INSTANCE ); + typeContributions.contributeJdbcTypeDescriptor( NVarcharJdbcTypeDescriptor.INSTANCE ); + typeContributions.contributeJdbcTypeDescriptor( LongNVarcharJdbcTypeDescriptor.INSTANCE ); + typeContributions.contributeJdbcTypeDescriptor( NClobJdbcTypeDescriptor.DEFAULT ); } } @@ -1182,7 +1181,7 @@ protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { JdbcTypeDescriptor descriptor; switch ( sqlCode ) { case Types.CLOB: { - descriptor = useInputStreamToInsertBlob() ? ClobTypeDescriptor.STREAM_BINDING : null; + descriptor = useInputStreamToInsertBlob() ? ClobJdbcTypeDescriptor.STREAM_BINDING : null; break; } default: { @@ -3418,7 +3417,7 @@ public boolean supportsBitType() { public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "X'" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); appender.appendSql( '\'' ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java index 5cdbfe2a84..afeb546751 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/OracleDialect.java @@ -59,8 +59,8 @@ import org.hibernate.type.JavaObjectType; import org.hibernate.type.NullType; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.BlobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.NullJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ObjectNullAsNullTypeJdbcTypeDescriptor; @@ -665,9 +665,9 @@ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry false ); - BlobTypeDescriptor descriptor = preferLong ? - BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING : - BlobTypeDescriptor.DEFAULT; + BlobJdbcTypeDescriptor descriptor = preferLong ? + BlobJdbcTypeDescriptor.PRIMITIVE_ARRAY_BINDING : + BlobJdbcTypeDescriptor.DEFAULT; typeContributions.contributeJdbcTypeDescriptor( descriptor ); } @@ -1189,7 +1189,7 @@ public static Replacer datetimeFormat(String format, boolean useFm, boolean rese @Override public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "hextoraw('" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); appender.appendSql( "')" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java index c922d54605..f7955b319a 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java @@ -66,9 +66,9 @@ import org.hibernate.type.JavaObjectType; import org.hibernate.type.PostgresUUIDType; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.BlobJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.ClobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcTypeDescriptor; @@ -356,9 +356,9 @@ public JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { // with @Lob will attempt to use // BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING. Since the // dialect uses oid for Blobs, byte arrays cannot be used. - return BlobTypeDescriptor.BLOB_BINDING; + return BlobJdbcTypeDescriptor.BLOB_BINDING; case Types.CLOB: - return ClobTypeDescriptor.CLOB_BINDING; + return ClobJdbcTypeDescriptor.CLOB_BINDING; default: return super.getSqlTypeDescriptorOverride( sqlCode ); } @@ -740,7 +740,7 @@ public String translateExtractField(TemporalUnit unit) { @Override public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "bytea '\\x" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); appender.appendSql( '\'' ); } diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index 7f63141de4..47daf7643b 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -45,9 +45,9 @@ import org.hibernate.tool.schema.internal.StandardSequenceExporter; import org.hibernate.tool.schema.spi.Exporter; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor; +import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.SmallIntJdbcTypeDescriptor; import java.sql.DatabaseMetaData; import java.sql.SQLException; @@ -159,7 +159,7 @@ public long getDefaultLobLength() { @Override protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { return sqlCode == Types.TINYINT - ? SmallIntTypeDescriptor.INSTANCE + ? SmallIntJdbcTypeDescriptor.INSTANCE : super.getSqlTypeDescriptorOverride( sqlCode ); } @@ -697,7 +697,7 @@ public static Replacer datetimeFormat(String format) { @Override public void appendBinaryLiteral(SqlAppender appender, byte[] bytes) { appender.appendSql( "0x" ); - PrimitiveByteArrayTypeDescriptor.INSTANCE.appendString( appender, bytes ); + PrimitiveByteArrayJavaTypeDescriptor.INSTANCE.appendString( appender, bytes ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java index a31a96ebab..1b19ae0f9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASEDialect.java @@ -35,8 +35,8 @@ import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.TimestampTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.TimestampJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.TinyIntJdbcTypeDescriptor; import static org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor.extractUsingTemplate; @@ -185,11 +185,11 @@ public boolean supportsBitType() { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { switch ( sqlCode ) { case Types.BOOLEAN: - return TinyIntTypeDescriptor.INSTANCE; + return TinyIntJdbcTypeDescriptor.INSTANCE; case Types.TIMESTAMP_WITH_TIMEZONE: // At least the jTDS driver does not support this type code if ( jtdsDriver ) { - return TimestampTypeDescriptor.INSTANCE; + return TimestampJdbcTypeDescriptor.INSTANCE; } default: return super.getSqlTypeDescriptorOverride( sqlCode ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java index a21cd9c4a0..84bdb14173 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java @@ -39,13 +39,13 @@ import org.hibernate.sql.ast.tree.select.SelectStatement; import org.hibernate.sql.exec.spi.JdbcOperation; import org.hibernate.type.JavaObjectType; -import org.hibernate.type.descriptor.jdbc.BlobTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.ClobTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.BlobJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.ClobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.NClobTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.NClobJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.ObjectNullAsNullTypeJdbcTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.SmallIntTypeDescriptor; -import org.hibernate.type.descriptor.jdbc.TinyIntTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.SmallIntJdbcTypeDescriptor; +import org.hibernate.type.descriptor.jdbc.TinyIntJdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeDescriptorRegistry; import java.sql.DatabaseMetaData; @@ -115,8 +115,8 @@ public JdbcTypeDescriptor resolveSqlTypeDescriptor( @Override public JdbcTypeDescriptor remapSqlTypeDescriptor(JdbcTypeDescriptor jdbcTypeDescriptor) { - if ( jtdsDriver && TinyIntTypeDescriptor.INSTANCE == jdbcTypeDescriptor ) { - return SmallIntTypeDescriptor.INSTANCE; + if ( jtdsDriver && TinyIntJdbcTypeDescriptor.INSTANCE == jdbcTypeDescriptor ) { + return SmallIntJdbcTypeDescriptor.INSTANCE; } return super.remapSqlTypeDescriptor( jdbcTypeDescriptor ); } @@ -177,13 +177,13 @@ public void contributeTypes(TypeContributions typeContributions, ServiceRegistry if ( jtdsDriver ) { typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( Types.NCLOB, - ClobTypeDescriptor.CLOB_BINDING + ClobJdbcTypeDescriptor.CLOB_BINDING ); typeContributions.getTypeConfiguration().getJdbcTypeDescriptorRegistry().addDescriptor( Types.NVARCHAR, - ClobTypeDescriptor.CLOB_BINDING + ClobJdbcTypeDescriptor.CLOB_BINDING ); - typeContributions.contributeJdbcTypeDescriptor( ClobTypeDescriptor.CLOB_BINDING ); + typeContributions.contributeJdbcTypeDescriptor( ClobJdbcTypeDescriptor.CLOB_BINDING ); } // Sybase requires a custom binder for binding untyped nulls with the NULL type @@ -210,20 +210,20 @@ public NationalizationSupport getNationalizationSupport() { protected JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode) { switch (sqlCode) { case Types.BLOB: - return BlobTypeDescriptor.PRIMITIVE_ARRAY_BINDING; + return BlobJdbcTypeDescriptor.PRIMITIVE_ARRAY_BINDING; case Types.CLOB: // Some Sybase drivers cannot support getClob. See HHH-7889 // The jTDS driver doesn't support the JDBC4 signatures using 'long length' for stream bindings - return jtdsDriver ? ClobTypeDescriptor.CLOB_BINDING : ClobTypeDescriptor.STREAM_BINDING_EXTRACTING; + return jtdsDriver ? ClobJdbcTypeDescriptor.CLOB_BINDING : ClobJdbcTypeDescriptor.STREAM_BINDING_EXTRACTING; case Types.NCLOB: // The jTDS driver doesn't support the JDBC4 signatures using 'long length' for stream bindings if ( jtdsDriver ) { - return NClobTypeDescriptor.NCLOB_BINDING; + return NClobJdbcTypeDescriptor.NCLOB_BINDING; } case Types.NVARCHAR: // The jTDS driver doesn't support the JDBC4 setNString method if ( jtdsDriver ) { - return NClobTypeDescriptor.NCLOB_BINDING; + return NClobJdbcTypeDescriptor.NCLOB_BINDING; } default: return super.getSqlTypeDescriptorOverride( sqlCode ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/UnsavedValueFactory.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/UnsavedValueFactory.java index 0a23f7e826..418b8bb0c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/UnsavedValueFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/UnsavedValueFactory.java @@ -6,7 +6,6 @@ */ package org.hibernate.engine.internal; -import java.io.Serializable; import java.lang.reflect.Constructor; import org.hibernate.InstantiationException; @@ -14,10 +13,11 @@ import org.hibernate.engine.spi.IdentifierValue; import org.hibernate.engine.spi.VersionValue; import org.hibernate.property.access.spi.Getter; -import org.hibernate.type.IdentifierType; -import org.hibernate.type.PrimitiveType; +import org.hibernate.type.BasicType; import org.hibernate.type.Type; +import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.VersionJavaTypeDescriptor; +import org.hibernate.type.descriptor.java.spi.PrimitiveJavaTypeDescriptor; /** * Helper for dealing with unsaved value handling @@ -68,8 +68,9 @@ public static IdentifierValue getUnsavedIdentifierValue( final Object defaultValue = identifierGetter.get( instantiate( constructor ) ); return new IdentifierValue( defaultValue ); } - else if ( identifierGetter != null && (identifierType instanceof PrimitiveType) ) { - final Object defaultValue = ( (PrimitiveType) identifierType ).getDefaultValue(); + final JavaTypeDescriptor jtd; + if ( identifierGetter != null && ( identifierType instanceof BasicType ) && ( jtd = ( (BasicType) identifierType ).getJavaTypeDescriptor() ) instanceof PrimitiveJavaTypeDescriptor ) { + final Object defaultValue = ( (PrimitiveJavaTypeDescriptor) jtd ).getDefaultValue(); return new IdentifierValue( defaultValue ); } else { @@ -90,7 +91,7 @@ else if ( "any".equals( unsavedValue ) ) { } else { try { - return new IdentifierValue( ( (IdentifierType) identifierType ).stringToObject( unsavedValue ) ); + return new IdentifierValue( ( (BasicType) identifierType ).getJavaTypeDescriptor().fromString( unsavedValue ) ); } catch ( ClassCastException cce ) { throw new MappingException( "Bad identifier type: " + identifierType.getName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java index 1dc1757fad..aa91224d9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java @@ -19,7 +19,7 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.service.ServiceRegistry; import org.hibernate.type.Type; -import org.hibernate.type.descriptor.java.UUIDTypeDescriptor; +import org.hibernate.type.descriptor.java.UUIDJavaTypeDescriptor; /** * An {@link IdentifierGenerator} which generates {@link UUID} values using a pluggable @@ -45,12 +45,12 @@ public class UUIDGenerator implements IdentifierGenerator, Configurable { private static final CoreMessageLogger LOG = CoreLogging.messageLogger( UUIDGenerator.class ); private UUIDGenerationStrategy strategy; - private UUIDTypeDescriptor.ValueTransformer valueTransformer; + private UUIDJavaTypeDescriptor.ValueTransformer valueTransformer; public static UUIDGenerator buildSessionFactoryUniqueIdentifierGenerator() { final UUIDGenerator generator = new UUIDGenerator(); generator.strategy = StandardRandomStrategy.INSTANCE; - generator.valueTransformer = UUIDTypeDescriptor.ToStringTransformer.INSTANCE; + generator.valueTransformer = UUIDJavaTypeDescriptor.ToStringTransformer.INSTANCE; return generator; } @@ -83,13 +83,13 @@ public void configure(Type type, Properties params, ServiceRegistry serviceRegis } if ( UUID.class.isAssignableFrom( type.getReturnedClass() ) ) { - valueTransformer = UUIDTypeDescriptor.PassThroughTransformer.INSTANCE; + valueTransformer = UUIDJavaTypeDescriptor.PassThroughTransformer.INSTANCE; } else if ( String.class.isAssignableFrom( type.getReturnedClass() ) ) { - valueTransformer = UUIDTypeDescriptor.ToStringTransformer.INSTANCE; + valueTransformer = UUIDJavaTypeDescriptor.ToStringTransformer.INSTANCE; } else if ( byte[].class.isAssignableFrom( type.getReturnedClass() ) ) { - valueTransformer = UUIDTypeDescriptor.ToBytesTransformer.INSTANCE; + valueTransformer = UUIDJavaTypeDescriptor.ToBytesTransformer.INSTANCE; } else { throw new HibernateException( "Unanticipated return type [" + type.getReturnedClass().getName() + "] for UUID conversion" ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java index 7811e7bdd1..e73e6c83ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java @@ -27,8 +27,9 @@ import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl; import org.hibernate.property.access.spi.Getter; -import org.hibernate.type.PrimitiveType; +import org.hibernate.type.BasicType; import org.hibernate.type.Type; +import org.hibernate.type.descriptor.java.spi.PrimitiveJavaTypeDescriptor; /** * Utility class for various reflection operations. @@ -339,8 +340,8 @@ public static Constructor getConstructor(Class clazz, Type[] types) throws Prope boolean found = true; for ( int j = 0; j < params.length; j++ ) { final boolean ok = types[j] == null || params[j].isAssignableFrom( types[j].getReturnedClass() ) || ( - types[j] instanceof PrimitiveType && - params[j] == ( (PrimitiveType) types[j] ).getPrimitiveClass() + types[j] instanceof BasicType && ( (BasicType) types[j] ).getJavaTypeDescriptor() instanceof PrimitiveJavaTypeDescriptor + && params[j] == ( (PrimitiveJavaTypeDescriptor) ( ( (BasicType) types[j] ).getJavaTypeDescriptor() ) ).getPrimitiveClass() ); if ( !ok ) { found = false; diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Array.java b/hibernate-core/src/main/java/org/hibernate/mapping/Array.java index 474d23d2d3..8f1742f295 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Array.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Array.java @@ -13,8 +13,10 @@ import org.hibernate.collection.internal.StandardArraySemantics; import org.hibernate.collection.spi.CollectionSemantics; import org.hibernate.type.ArrayType; +import org.hibernate.type.BasicType; import org.hibernate.type.CollectionType; -import org.hibernate.type.PrimitiveType; +import org.hibernate.type.descriptor.java.JavaTypeDescriptor; +import org.hibernate.type.descriptor.java.spi.PrimitiveJavaTypeDescriptor; /** * An array mapping has a primary key consisting of the key columns + index column. @@ -30,10 +32,11 @@ public Array(MetadataBuildingContext buildingContext, PersistentClass owner) { public Class getElementClass() throws MappingException { if ( elementClassName == null ) { - org.hibernate.type.Type elementType = getElement().getType(); - return isPrimitiveArray() - ? ( (PrimitiveType) elementType ).getPrimitiveClass() - : elementType.getReturnedClass(); + final org.hibernate.type.Type elementType = getElement().getType(); + if ( isPrimitiveArray() ) { + return ( (PrimitiveJavaTypeDescriptor) ( (BasicType) elementType ).getJavaTypeDescriptor() ).getPrimitiveClass(); + } + return elementType.getReturnedClass(); } else { try { diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java index 58914e0e76..6ee14200d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/BasicValue.java @@ -39,7 +39,7 @@ import org.hibernate.type.BasicType; import org.hibernate.type.ConvertedBasicType; import org.hibernate.type.Type; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; import org.hibernate.type.descriptor.java.MutabilityPlan; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; @@ -67,7 +67,7 @@ public class BasicValue extends SimpleValue implements JdbcTypeDescriptorIndicat private String explicitTypeName; private Map explicitLocalTypeParams; - private Function explicitJavaTypeAccess; + private Function explicitJavaTypeAccess; private Function explicitSqlTypeAccess; private Function explicitMutabilityPlanAccess; private Function implicitJavaTypeAccess; @@ -131,7 +131,7 @@ public void setJpaAttributeConverterDescriptor(ConverterDescriptor descriptor) { } @SuppressWarnings({"rawtypes"}) - public void setExplicitJavaTypeAccess(Function explicitJavaTypeAccess) { + public void setExplicitJavaTypeAccess(Function explicitJavaTypeAccess) { this.explicitJavaTypeAccess = explicitJavaTypeAccess; } @@ -348,7 +348,7 @@ public TypeConfiguration getTypeConfiguration() { // determine JTD if we can if ( explicitJavaTypeAccess != null ) { - final BasicJavaDescriptor explicitJtd = explicitJavaTypeAccess.apply( typeConfiguration ); + final BasicJavaTypeDescriptor explicitJtd = explicitJavaTypeAccess.apply( typeConfiguration ); if ( explicitJtd != null ) { jtd = explicitJtd; } @@ -371,7 +371,7 @@ public TypeConfiguration getTypeConfiguration() { } final TypeDefinitionRegistry typeDefinitionRegistry = getBuildingContext().getTypeDefinitionRegistry(); - final TypeDefinition autoAppliedTypeDef = typeDefinitionRegistry.resolveAutoApplied( (BasicJavaDescriptor) jtd ); + final TypeDefinition autoAppliedTypeDef = typeDefinitionRegistry.resolveAutoApplied( (BasicJavaTypeDescriptor) jtd ); if ( autoAppliedTypeDef != null && ( !jtd.getJavaTypeClass().isEnum() || enumerationStyle == null ) ) { log.debug( "BasicValue resolution matched auto-applied type-definition" ); return autoAppliedTypeDef.resolve( @@ -430,7 +430,7 @@ private static Resolution interpretExplicitlyNamedType( String name, EnumType enumerationStyle, Function implicitJavaTypeAccess, - Function explicitJtdAccess, + Function explicitJtdAccess, Function explicitStdAccess, Function explicitMutabilityPlanAccess, ConverterDescriptor converterDescriptor, diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index b2efa6955d..c5616d4d17 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -51,7 +51,7 @@ import org.hibernate.type.descriptor.JdbcTypeNameMapper; import org.hibernate.type.descriptor.converter.AttributeConverterJdbcTypeDescriptorAdapter; import org.hibernate.type.descriptor.converter.AttributeConverterTypeAdapter; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.descriptor.jdbc.LobTypeMappings; import org.hibernate.type.descriptor.jdbc.NationalizedTypeMappings; @@ -657,7 +657,7 @@ public TypeConfiguration getTypeConfiguration() { } ); - final BasicJavaDescriptor domainJtd = (BasicJavaDescriptor) jpaAttributeConverter.getDomainJavaTypeDescriptor(); + final BasicJavaTypeDescriptor domainJtd = (BasicJavaTypeDescriptor) jpaAttributeConverter.getDomainJavaTypeDescriptor(); // build the SqlTypeDescriptor adapter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableTemporalParameterType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableTemporalParameterType.java deleted file mode 100644 index 3d3abcd185..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AllowableTemporalParameterType.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ -package org.hibernate.metamodel.model.domain; - -import jakarta.persistence.TemporalType; - -import org.hibernate.type.spi.TypeConfiguration; - -/** - * Specialization of DomainType for types that can be used as temporal bind values - * for a query parameter - * - * @author Steve Ebersole - */ -public interface AllowableTemporalParameterType extends AllowableParameterType { - /** - * Convert the value and/or type to the specified temporal precision - */ - AllowableTemporalParameterType resolveTemporalPrecision(TemporalType temporalPrecision, TypeConfiguration typeConfiguration); -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ArrayTupleType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ArrayTupleType.java index 83056f0745..57233baa42 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ArrayTupleType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/ArrayTupleType.java @@ -15,7 +15,7 @@ import org.hibernate.metamodel.model.domain.TupleType; import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; -import org.hibernate.type.descriptor.java.ObjectArrayTypeDescriptor; +import org.hibernate.type.descriptor.java.ObjectArrayJavaTypeDescriptor; /** * @author Christian Beikov @@ -23,12 +23,12 @@ public class ArrayTupleType implements TupleType, AllowableParameterType, AllowableFunctionReturnType, MappingModelExpressable { - private final ObjectArrayTypeDescriptor javaTypeDescriptor; + private final ObjectArrayJavaTypeDescriptor javaTypeDescriptor; private final SqmExpressable[] components; public ArrayTupleType(SqmExpressable[] components) { this.components = components; - this.javaTypeDescriptor = new ObjectArrayTypeDescriptor( getTypeDescriptors( components ) ); + this.javaTypeDescriptor = new ObjectArrayJavaTypeDescriptor( getTypeDescriptors( components ) ); } private static JavaTypeDescriptor[] getTypeDescriptors(SqmExpressable[] components) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java index d9230d1d80..9a87f631dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/DiscriminatorType.java @@ -27,9 +27,9 @@ import org.hibernate.type.descriptor.ValueBinder; import org.hibernate.type.descriptor.ValueExtractor; import org.hibernate.type.descriptor.WrapperOptions; -import org.hibernate.type.descriptor.java.ClassTypeDescriptor; +import org.hibernate.type.descriptor.java.ClassJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; -import org.hibernate.type.descriptor.java.StringTypeDescriptor; +import org.hibernate.type.descriptor.java.StringJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; /** @@ -37,7 +37,7 @@ * * @author Steve Ebersole */ -public class DiscriminatorType extends AbstractType implements org.hibernate.type.DiscriminatorType, BasicType, ValueExtractor, ValueBinder { +public class DiscriminatorType extends AbstractType implements BasicType, ValueExtractor, ValueBinder { private final BasicType underlyingType; private final Loadable persister; @@ -225,11 +225,6 @@ public int getColumnSpan(Mapping mapping) throws MappingException { return underlyingType.getColumnSpan( mapping ); } - @Override - public T stringToObject(CharSequence sequence) throws Exception { - return ( (org.hibernate.type.DiscriminatorType) underlyingType ).stringToObject( sequence ); - } - @Override public boolean canDoExtraction() { return underlyingType.canDoExtraction(); @@ -238,8 +233,8 @@ public boolean canDoExtraction() { @Override public JavaTypeDescriptor getExpressableJavaTypeDescriptor() { return (JavaTypeDescriptor) ( EntityMode.POJO == persister.getEntityMode() ? - ClassTypeDescriptor.INSTANCE : - StringTypeDescriptor.INSTANCE ); + ClassJavaTypeDescriptor.INSTANCE : + StringJavaTypeDescriptor.INSTANCE ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index 389d2ef5f7..140e4a32bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -66,7 +66,6 @@ import org.hibernate.sql.results.graph.entity.internal.EntityResultJoinedSubclassImpl; import org.hibernate.type.BasicType; import org.hibernate.type.CompositeType; -import org.hibernate.type.DiscriminatorType; import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.Type; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -139,7 +138,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { private final Object discriminatorValue; private final String discriminatorSQLString; - private final DiscriminatorType discriminatorType; + private final BasicType discriminatorType; private final String explicitDiscriminatorColumnName; private final String discriminatorAlias; @@ -183,7 +182,7 @@ public JoinedSubclassEntityPersister( explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() ); discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() ); } - discriminatorType = (DiscriminatorType) persistentClass.getDiscriminator().getType(); + discriminatorType = (BasicType) persistentClass.getDiscriminator().getType(); if ( persistentClass.isDiscriminatorValueNull() ) { discriminatorValue = NULL_DISCRIMINATOR; discriminatorSQLString = InFragment.NULL; @@ -194,7 +193,7 @@ else if ( persistentClass.isDiscriminatorValueNotNull() ) { } else { try { - discriminatorValue = discriminatorType.stringToObject( persistentClass.getDiscriminatorValue() ); + discriminatorValue = discriminatorType.getJavaTypeDescriptor().fromString( persistentClass.getDiscriminatorValue() ); discriminatorSQLString = discriminatorType.getJdbcTypeDescriptor().getJdbcLiteralFormatter( (JavaTypeDescriptor) discriminatorType.getJavaTypeDescriptor() ) .toJdbcLiteral( discriminatorValue, @@ -535,7 +534,7 @@ else if ( persistentClass.isDiscriminatorValueNotNull() ) { // the type indicated by `#discriminatorType` (String -> Integer, e.g.). try { Table table = persistentClass.getTable(); - final Object convertedDiscriminatorValue = discriminatorType.stringToObject( discriminatorSQLString ); + final Object convertedDiscriminatorValue = discriminatorType.getJavaTypeDescriptor().fromString( discriminatorSQLString ); discriminatorValues = new String[subclassSpan]; initDiscriminatorProperties( factory, jdbcEnvironment, subclassSpanMinusOne, table, convertedDiscriminatorValue ); @@ -592,7 +591,7 @@ else if ( sc.isDiscriminatorValueNotNull() ) { } else { try { - discriminatorValue = discriminatorType.stringToObject( sc.getDiscriminatorValue() ); + discriminatorValue = discriminatorType.getJavaTypeDescriptor().fromString( sc.getDiscriminatorValue() ); } catch (ClassCastException cce) { throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index a2add0322a..af04d3f9f0 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -61,7 +61,6 @@ import org.hibernate.sql.ast.tree.predicate.Predicate; import org.hibernate.type.AssociationType; import org.hibernate.type.BasicType; -import org.hibernate.type.DiscriminatorType; import org.hibernate.type.Type; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; @@ -116,7 +115,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { private final String discriminatorFormula; private final String discriminatorFormulaTemplate; private final String discriminatorAlias; - private final DiscriminatorType discriminatorType; + private final BasicType discriminatorType; private final Object discriminatorValue; private final String discriminatorSQLValue; private final boolean discriminatorInsertable; @@ -326,7 +325,7 @@ public SingleTableEntityPersister( discriminatorFormula = null; discriminatorFormulaTemplate = null; } - discriminatorType = (DiscriminatorType) persistentClass.getDiscriminator().getType(); + discriminatorType = (BasicType) persistentClass.getDiscriminator().getType(); if ( persistentClass.isDiscriminatorValueNull() ) { discriminatorValue = NULL_DISCRIMINATOR; discriminatorSQLValue = InFragment.NULL; @@ -340,7 +339,7 @@ else if ( persistentClass.isDiscriminatorValueNotNull() ) { else { discriminatorInsertable = persistentClass.isDiscriminatorInsertable() && !discrimValue.hasFormula(); try { - discriminatorValue = discriminatorType.stringToObject( persistentClass.getDiscriminatorValue() ); + discriminatorValue = discriminatorType.getJavaTypeDescriptor().fromString( persistentClass.getDiscriminatorValue() ); discriminatorSQLValue = discriminatorType.getJdbcTypeDescriptor().getJdbcLiteralFormatter( (JavaTypeDescriptor) discriminatorType.getJavaTypeDescriptor() ) .toJdbcLiteral( discriminatorValue, @@ -444,7 +443,7 @@ else if ( sc.isDiscriminatorValueNotNull() ) { try { addSubclassByDiscriminatorValue( subclassesByDiscriminatorValueLocal, - discriminatorType.stringToObject( sc.getDiscriminatorValue() ), + discriminatorType.getJavaTypeDescriptor().fromString( sc.getDiscriminatorValue() ), sc.getEntityName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/procedure/internal/FunctionReturnImpl.java b/hibernate-core/src/main/java/org/hibernate/procedure/internal/FunctionReturnImpl.java index ff9e0325c2..65d0ee0b12 100644 --- a/hibernate-core/src/main/java/org/hibernate/procedure/internal/FunctionReturnImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/procedure/internal/FunctionReturnImpl.java @@ -21,7 +21,7 @@ import org.hibernate.sql.exec.internal.JdbcCallParameterExtractorImpl; import org.hibernate.sql.exec.internal.JdbcCallRefCursorExtractorImpl; import org.hibernate.sql.exec.spi.JdbcCallFunctionReturn; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.jdbc.JdbcTypeDescriptor; import org.hibernate.type.spi.TypeConfiguration; @@ -62,7 +62,7 @@ public JdbcCallFunctionReturn toJdbcFunctionReturn(SharedSessionContractImplemen final TypeConfiguration typeConfiguration = persistenceContext.getFactory().getMetamodel().getTypeConfiguration(); final JdbcTypeDescriptor sqlTypeDescriptor = typeConfiguration.getJdbcTypeDescriptorRegistry() .getDescriptor( getJdbcTypeCode() ); - final BasicJavaDescriptor javaTypeMapping = sqlTypeDescriptor + final BasicJavaTypeDescriptor javaTypeMapping = sqlTypeDescriptor .getJdbcRecommendedJavaTypeMapping( null, null, typeConfiguration ); ormType = typeConfiguration.standardBasicTypeForJavaType( javaTypeMapping.getJavaType().getClass() ); parameterExtractor = new JdbcCallParameterExtractorImpl( procedureCall.getProcedureName(), null, 0, ormType ); diff --git a/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterImpl.java b/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterImpl.java index aac2aef4c4..df31ae6371 100644 --- a/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterImpl.java @@ -15,12 +15,12 @@ import org.hibernate.engine.jdbc.env.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.metamodel.model.domain.AllowableParameterType; -import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.procedure.spi.NamedCallableQueryMemento; import org.hibernate.procedure.spi.ParameterStrategy; import org.hibernate.procedure.spi.ProcedureCallImplementor; import org.hibernate.procedure.spi.ProcedureParameterImplementor; import org.hibernate.query.AbstractQueryParameter; +import org.hibernate.query.internal.BindingTypeHelper; import org.hibernate.query.spi.QueryParameterBinding; import org.hibernate.type.BasicType; import org.hibernate.type.ProcedureParameterNamedBinder; @@ -136,20 +136,14 @@ public void prepare( int startIndex, ProcedureCallImplementor procedureCall) throws SQLException { final QueryParameterBinding binding = procedureCall.getParameterBindings().getBinding( this ); - final AllowableParameterType typeToUse; - - // for Calendar binding with an explicit TemporalType we may need to adjust this... final TypeConfiguration typeConfiguration = procedureCall.getSession().getFactory().getTypeConfiguration(); - if ( binding != null && binding.getExplicitTemporalPrecision() != null ) { - typeToUse = ( (AllowableTemporalParameterType) getHibernateType() ).resolveTemporalPrecision( - binding.getExplicitTemporalPrecision(), - typeConfiguration - ); - } - else { - //set up the Type we will use for binding as the explicit type. - typeToUse = getHibernateType(); - } + final AllowableParameterType typeToUse = BindingTypeHelper.INSTANCE.resolveTemporalPrecision( + binding == null || binding.getExplicitTemporalPrecision() == null + ? null + : binding.getExplicitTemporalPrecision(), + getHibernateType(), + typeConfiguration + ); if ( mode == ParameterMode.INOUT || mode == ParameterMode.OUT ) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/internal/BindingTypeHelper.java b/hibernate-core/src/main/java/org/hibernate/query/internal/BindingTypeHelper.java index 872830d6fd..ce0fa9bd4d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/internal/BindingTypeHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/query/internal/BindingTypeHelper.java @@ -15,7 +15,6 @@ import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.model.domain.AllowableParameterType; -import org.hibernate.metamodel.model.domain.AllowableTemporalParameterType; import org.hibernate.type.CalendarDateType; import org.hibernate.type.CalendarTimeType; import org.hibernate.type.CalendarType; @@ -39,16 +38,25 @@ public class BindingTypeHelper { private BindingTypeHelper() { } - @SuppressWarnings("unchecked") public AllowableParameterType resolveTemporalPrecision( TemporalType precision, - AllowableParameterType baseType, + AllowableParameterType declaredParameterType, TypeConfiguration typeConfiguration) { - if ( ! ( baseType instanceof AllowableTemporalParameterType ) ) { - throw new UnsupportedOperationException( "Cannot treat non-temporal parameter type with temporal precision" ); + if ( precision != null ) { + if ( !( declaredParameterType.getExpressableJavaTypeDescriptor() instanceof TemporalJavaTypeDescriptor ) ) { + throw new UnsupportedOperationException( + "Cannot treat non-temporal parameter type with temporal precision" + ); + } + final TemporalJavaTypeDescriptor temporalJtd = (TemporalJavaTypeDescriptor) declaredParameterType.getExpressableJavaTypeDescriptor(); + if ( temporalJtd.getPrecision() != precision ) { + return typeConfiguration.getBasicTypeRegistry().resolve( + temporalJtd.resolveTypeForPrecision( precision, typeConfiguration ), + TemporalJavaTypeDescriptor.resolveJdbcTypeCode( precision ) + ); + } } - - return ( (AllowableTemporalParameterType) baseType ).resolveTemporalPrecision( precision, typeConfiguration ); + return declaredParameterType; } public AllowableParameterType determineTypeForTemporalType(TemporalType temporalType, AllowableParameterType baseType, Object bindValue) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java index 2400512089..414b808115 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmBasicValuedSimplePath.java @@ -16,7 +16,7 @@ import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SemanticQueryWalker; import org.hibernate.query.sqm.SqmPathSource; -import org.hibernate.type.descriptor.java.BasicJavaDescriptor; +import org.hibernate.type.descriptor.java.BasicJavaTypeDescriptor; import org.hibernate.type.descriptor.java.JavaTypeDescriptor; /** @@ -68,8 +68,8 @@ public SqmPathSource getNodeType() { } @Override - public BasicJavaDescriptor getJavaTypeDescriptor() { - return (BasicJavaDescriptor) super.getJavaTypeDescriptor(); + public BasicJavaTypeDescriptor getJavaTypeDescriptor() { + return (BasicJavaTypeDescriptor) super.getJavaTypeDescriptor(); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java index 8f949bbc82..c1061eb301 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/LiteralHelper.java @@ -16,9 +16,9 @@ import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.hql.spi.SqmCreationState; import org.hibernate.type.StandardBasicTypes; -import org.hibernate.type.descriptor.java.JdbcDateTypeDescriptor; -import org.hibernate.type.descriptor.java.JdbcTimeTypeDescriptor; -import org.hibernate.type.descriptor.java.JdbcTimestampTypeDescriptor; +import org.hibernate.type.descriptor.java.JdbcDateJavaTypeDescriptor; +import org.hibernate.type.descriptor.java.JdbcTimeJavaTypeDescriptor; +import org.hibernate.type.descriptor.java.JdbcTimestampJavaTypeDescriptor; /** * @author Steve Ebersole @@ -26,7 +26,7 @@ public class LiteralHelper { public static SqmLiteral timestampLiteralFrom(String literalText, SqmCreationState creationState) { final Timestamp literal = Timestamp.valueOf( - LocalDateTime.from( JdbcTimestampTypeDescriptor.LITERAL_FORMATTER.parse( literalText ) ) + LocalDateTime.from( JdbcTimestampJavaTypeDescriptor.LITERAL_FORMATTER.parse( literalText ) ) ); return new SqmLiteral<>( @@ -53,7 +53,7 @@ public static SqmLiteral integerLiteral(int value, QueryEngine queryEng } public static SqmLiteral dateLiteralFrom(String literalText, SqmCreationState creationState) { - final LocalDate localDate = LocalDate.from( JdbcDateTypeDescriptor.LITERAL_FORMATTER.parse( literalText ) ); + final LocalDate localDate = LocalDate.from( JdbcDateJavaTypeDescriptor.LITERAL_FORMATTER.parse( literalText ) ); final Date literal = new Date( localDate.toEpochDay() ); return new SqmLiteral<>( @@ -64,7 +64,7 @@ public static SqmLiteral dateLiteralFrom(String literalText, SqmCreationSt } public static SqmLiteral