-
Notifications
You must be signed in to change notification settings - Fork 3.6k
HHH-16125 PostgreSQL enum types + reimplementation of enum support #6448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -36,32 +36,46 @@ | |||
*/ | |||
int getSqlTypeCode(); | |||
|
|||
default String getTypeName(Size columnSize, Class<?> returnedClass) { | |||
return getTypeName( columnSize ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
|
||
try ( SessionFactoryImplementor sf = (SessionFactoryImplementor) metadata.buildSessionFactory() ) { | ||
EntityPersister p = sf.getRuntimeMetamodels() | ||
.getMappingMetamodel() | ||
.getEntityDescriptor( AddressLevel.class.getName() ); | ||
//noinspection unchecked | ||
ConvertedBasicType<Nature> runtimeType = (ConvertedBasicType<Nature>) p.getPropertyType( "nature" ); | ||
assertEquals( Types.VARCHAR, runtimeType.getJdbcType().getJdbcTypeCode() ); | ||
BasicType<Nature> runtimeType = (BasicType<Nature>) p.getPropertyType( "nature" ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
throw new HibernateException("Enum class not found: " + enumClassName, exception); | ||
} | ||
} else { | ||
enumClass = (Class<T>) reader.getReturnedClass().asSubclass(Enum.class); |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
00ef478
to
b0f447e
Compare
@@ -167,8 +165,7 @@ | |||
|
|||
@Incubating | |||
default String getSpecializedTypeDeclaration(Dialect dialect) { | |||
final BasicValueConverter<T, ?> valueConverter = getValueConverter(); | |||
return valueConverter == null ? null : valueConverter.getSpecializedTypeDeclaration( getJdbcType(), dialect ); | |||
return getMappedJavaType().getSpecializedTypeDeclaration( getJdbcType(), getValueConverter(), dialect ); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
305850d
to
0c6d089
Compare
incl attempt to fix PK to FK copying
this is probably a pre-existing hole in the logic, not related really related to my work
- introduce SqlTypes.ENUM - no more converters! - finish of Potgres enum support - disable BIND for enums in Criteria on PostgreSQL (PostgreSQL doesn't do the needed type conversion to the enum type)
it never belonged there!
fixes allowing correct serialization/deserialization of enums includes workaround for StructJdbcType sending us a BigDecimal (need better solution)
…ion details these are bad tests; they don't test observable behavior
Superseded by #6480. |
First try was #6232.
This time things went somewhat more smoothly, except that I ran into a problem with enum types in foreign keys.
I'm now concerned that we'll have to abandon the whole
specialiedTypeDeclaration
thing I added to let converters have a vote on the generated DDL types. In place of that I would probably introduceSqlTypes.ENUM
and pass the enum type along with theSize
class. So there would be a realDdlType
for native enums.