Skip to content
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

Changes for Hibernate Reactive #9264

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

DavideD
Copy link
Member

@DavideD DavideD commented Nov 15, 2024

Fix HHH-18854 (I think)

These changes make it possible for me to use Hibernate Reactive with ORM 7 and Postgres.
I still need to fix some issues with the other databases, but I don't think I will have more changes to include for now.

Basically, I needed some way to intercept the creation of the id generator.

Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavideD Could you please add comments to every new method and constructor explaining that it's used by Reactive.

@DavideD
Copy link
Member Author

DavideD commented Nov 18, 2024

Comments added

@gavinking
Copy link
Member

Comments added

Thanks man

Hibernate Reactive extends this class and needs to access/overrides some
of the methods.
Hibernate Reactive needs to replace or extends the original
id generators.

This changes make it possible to pass a function to the EntityMetamodel
that allows Hibernate Reactive to replace the original id generators
@DavideD
Copy link
Member Author

DavideD commented Nov 19, 2024

Rebased to the latest changes and added a minor refactoring: f0b8dca

With this change I can remove a lot of duplicate code in Hibernate
Reactive.
refactoring

Allow me to remove some duplicated code in Hibernate Reactive
@DavideD
Copy link
Member Author

DavideD commented Nov 20, 2024

Added another small refactoring: 25790c2

Comment on lines +472 to +485
/**
* A factory for the creation of an EntityMetamodel.
* <p>
* Hibernate Reactive uses it to pass its own entity metamodel class
* and adapt the identifier generators.
*/
public static class EntityMetamodelFactory {
public EntityMetamodel createEntityMetamodel(
PersistentClass persistentClass,
EntityPersister persister,
RuntimeModelCreationContext creationContext) {
return new EntityMetamodel( persistentClass, persister, creationContext );
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavideD instead of introducing this new class, could you just add a new createEntityMetamodel() operation to RuntimeModelCreationContext?

Or, if that doesn't work, could you at least make it a @FunctionInterface?

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.

2 participants