Skip to content

HHH-16125 reimplement enum support + PostgreSQL enum types #6480

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

Merged
merged 12 commits into from
Apr 29, 2023

Conversation

gavinking
Copy link
Member

Supersedes #6448.

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)
@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Apr 29, 2023

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [f605c37, eee0aef]

› This message was automatically generated.

@gavinking gavinking force-pushed the 16125-min branch 3 times, most recently from 5176171 to 792b787 Compare April 29, 2023 10:25
@@ -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

Invoking [DdlType.getTypeName](1) should be avoided because it has been deprecated.

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

Invoking [EntityPersister.getPropertyType](1) should be avoided because it has been deprecated.
fixes allowing correct serialization/deserialization of enums
includes workaround for StructJdbcType sending us a BigDecimal (need better solution)
@gavinking
Copy link
Member Author

I'm going to merge this very important work, even though I know there will be more fallout.

@gavinking gavinking merged commit 20b1570 into hibernate:main Apr 29, 2023
@gavinking gavinking deleted the 16125-min branch June 15, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant