Skip to content

Conversation

gavinking
Copy link
Member

[Please describe here what your change is about]


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


Signed-off-by: Gavin King <gavin@hibernate.org>
@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Aug 14, 2024

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: [a704341, 6969e64]

› This message was automatically generated.

@gavinking
Copy link
Member Author

@yrodiere @Sanne This is really, really fragile.

Would it be better to add a clone() method to MetadataImpl and have Quarkus call that instead?

Signed-off-by: Gavin King <gavin@hibernate.org>
@gavinking
Copy link
Member Author

Would it be better to add a clone() method to MetadataImpl and have Quarkus call that instead?

Looks like it should be called trim().

WDYT?

Comment on lines +684 to +710
@Internal
// called by the Quarkus extension
public MetadataImpl trim() {
return new MetadataImpl(
getUUID(),
getMetadataBuildingOptions(), //TODO Replace this
getEntityBindingMap(),
getComposites(),
getGenericComponentsMap(),
getEmbeddableDiscriminatorTypesMap(),
getMappedSuperclassMap(),
getCollectionBindingMap(),
getTypeDefinitionMap(),
getFilterDefinitions(),
getFetchProfileMap(),
getImports(), // ok
getIdGeneratorDefinitionMap(),
getNamedQueryMap(),
getNamedNativeQueryMap(), // TODO might contain references to org.hibernate.loader.custom.ConstructorResultColumnProcessor, org.hibernate.type.TypeStandardSQLFunction
getNamedProcedureCallMap(),
getSqlResultSetMappingMap(), //TODO might contain NativeSQLQueryReturn (as namedNativeQueryMap above)
getNamedEntityGraphs(), //TODO reference to *annotation* instance ! FIXME or ignore feature?
getSqlFunctionMap(), // ok
getDatabase(), // Cleaned up: used to include references to MetadataBuildingOptions, etc.
getBootstrapContext() //FIXME WHOA!
);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

👀

@gavinking gavinking changed the title add a comment to mark internal constructor called by quarkus add a method for use by quarkus extension Aug 26, 2024
@yrodiere
Copy link
Member

yrodiere commented Aug 26, 2024

As discussed over Zulip, this is just one of many places where the integration between Quarkus and Hibernate ORM is very tight, to the point of being fragile, and that's the reason we only support running Quarkus with the exact version of Hibernate ORM it references in its BOM.

We can merge this if you want, but IMO it only makes sense if we also add a test to check that trim does what Quarkus expects (which is not immediately clear to me here, I'd have to dig into Quarkus code to remember -- might be worth a comment?).

@yrodiere
Copy link
Member

Also FWIW MetadataImpl is internal, so unless you move trim to some SPI, there's a decent chance it'll just get removed in a later commit by someone not aware of what it's for.

@gavinking
Copy link
Member Author

Also FWIW MetadataImpl is internal, so unless you move trim to some SPI, there's a decent chance it'll just get removed in a later commit by someone not aware of what it's for.

Which is why I added a comment.

The main issue is that the constructor that Quarkus was calling was not even commented as such.

@yrodiere
Copy link
Member

Also FWIW MetadataImpl is internal, so unless you move trim to some SPI, there's a decent chance it'll just get removed in a later commit by someone not aware of what it's for.

Which is why I added a comment.

Fair enough.

LGTM, though I think changes that impact code we ship need a Jira issue, so we'll need to add that before merging.

@gavinking gavinking marked this pull request as draft December 20, 2024 16:54
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