Skip to content

Conversation

@beikov
Copy link
Member

@beikov beikov commented Nov 6, 2025

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


https://hibernate.atlassian.net/browse/HHH-19749
https://hibernate.atlassian.net/browse/HHH-18860

@Override
public @Nullable String getCustomReadExpression() {
return null;
public static class KeyColumn extends SelectableMappingImpl implements TableDetails.KeyColumn {

Check notice

Code scanning / CodeQL

Class has same name as super class Note

KeyColumn has the same name as its supertype
org.hibernate.metamodel.mapping.TableDetails$KeyColumn
.
@beikov beikov force-pushed the HHH-18860 branch 2 times, most recently from f0940a8 to 89e13a5 Compare November 11, 2025 16:54
Copy link
Member

@sebersole sebersole left a comment

Choose a reason for hiding this comment

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

Overall, seemed reasonable to me. I did have one confusion I noted.

@Override
public String getSelectableName() {
return selectablePath == null ? null : selectablePath.getSelectableName();
return selectablePath.getSelectableName();
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused here... You explicitly marked selectablePath as nullable, but then removed the null handling?

Copy link
Member Author

Choose a reason for hiding this comment

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

The constructor argument is @Nullable, but the field is non-null since that is handled in the constructor.

this.selectablePath = selectablePath == null ? new SelectablePath( selectionExpression ) : selectablePath;

@beikov beikov merged commit c3e819f into hibernate:main Nov 13, 2025
26 of 27 checks passed
@beikov beikov deleted the HHH-18860 branch November 13, 2025 18:06
return dialect.getDoublePrecision();
}
else {
return Math.min( dialect.getDefaultDecimalPrecision(), (int) ceil( dialect.getDoublePrecision() * LOG_BASE10OF2 ) );
Copy link
Member

@gavinking gavinking Nov 15, 2025

Choose a reason for hiding this comment

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

@beikov I don't understand this logic, and it looks wrong to me. Why would dialect.getDoublePrecision() come into it if we're not using a floating-point type on the database side? Note that dialect.getDoublePrecision() returns a value that might be measured in binary or decimal digits depending on the database, and so multiplying it by log_10(2) is probably wrong. It's only meant as an argument to the float(n) type.

Perhaps this should be the number of decimal digits of precision in a Java double, i.e. 17?

return dialect.getFloatPrecision();
}
else {
return Math.min( dialect.getDefaultDecimalPrecision(), (int) ceil( dialect.getFloatPrecision() * LOG_BASE10OF2 ) );
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, should this just be 8 instead of using dialect.getFloatPrecision()?

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.

3 participants