Skip to content

Conversation

@dreab8
Copy link
Member

@dreab8 dreab8 commented Sep 16, 2024

https://hibernate.atlassian.net/browse/HHH-18462

this is an alternative to #8843

[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.


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.

Couple of comments. Otherwise LGTM.

Comment on lines 32 to 34
Type getIdentifierType(String className) throws MappingException;
String getIdentifierPropertyName(String className) throws MappingException;
Type getReferencedPropertyType(String className, String propertyName) throws MappingException;
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just delete this methods and leave the interface empty, right?

Copy link
Member

Choose a reason for hiding this comment

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

This would unfortunately be a binary incompatible change, though maybe that is ok since this is an SPI?

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe we guarantee binary compatibility between major versions.

* 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.type.spi;
Copy link
Member

Choose a reason for hiding this comment

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

Should it maybe just go into org.hibernate.type, since that package uses it?

Copy link
Member

@gavinking gavinking Sep 16, 2024

Choose a reason for hiding this comment

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

What I mean is: with this design, we're leaking an SPI type onto what is in principle still an API.

Now, yeah, I realize that the stuff in org.hibernate.type has been gradually reinterpreted as SPI over the years, but even if it is now SPI, it's still OK for MappingContext to live right there alongside its main usages.

@dreab8 dreab8 force-pushed the HHH-18462_mappingcontext branch from b64a7a1 to 2f72f51 Compare September 16, 2024 10:12
@dreab8 dreab8 force-pushed the HHH-18462_mappingcontext branch from 2f72f51 to 504e059 Compare September 16, 2024 13:28
@sebersole
Copy link
Member

What is the reason for keeping Mapping? Other than that, lgtm.

@gavinking
Copy link
Member

What is the reason for keeping Mapping?

Because there has to be some place those operations are declared, and it has to be available at both boot time and at runtime. And AFAICT there's no other existing interface that makes sense. @dreab8 suggested putting them on TypeConfiguration, but to me they really don't seem to fit with the other operations of that class.

@sebersole
Copy link
Member

I think you are thinking of MappingContext which actually defines the methods.

@Deprecated(since = "6.0")
public interface Mapping extends MappingContext {
}

If this really was deprecated since 6.0 we could just remove it. What's the argument for keeping it?

@gavinking
Copy link
Member

Oh, sorry, my bad, yes, I misread.

@dreab8
Copy link
Member Author

dreab8 commented Sep 16, 2024

@sebersole i kept it based on your comments on my first PR #8769

@sebersole
Copy link
Member

sebersole commented Sep 16, 2024

@sebersole i kept it based on your comments on my first PR #8769

Sure. Just questioning my suggestion :)

I guess it is nicer to leave it for the time being for people upgrading.

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.

4 participants