The changes introduced in [https://hibernate.atlassian.net/browse/HHH-15870|https://hibernate.atlassian.net/browse/HHH-15870|smart-link] cause false positives in several cases in our project.
* TIMESTAMP: in org.hibernate.tool.schema.internal.{{ColumnDefinitions.hasMatchingLength(Column, ColumnInformation, Metadata, Dialect)}} the length of the field is compared against the required precision. (for timestamp e.g. postgres reports 29 length with 6 decimalDigits) * floating point values: the required precision is much higher (e.g. 57 53 for float ) than the precision reported by the database (e.g. 17 for REAL). this causes problems even if fixing the issue above * text: longer text fields ( e.g. TEXT with length int_max) should be acceptable as column type for a string with required length 255 * int vs smallint: when storing enums an integer column should be acceptable but is rejected due to smallint and int not matching according to {{ColumnDefinitions.hasMatchingType}}
An additional problem:
When specifying a type via {{@Column(columnDefinition = "...")}}, the DDL validator will still use the inferred value for figuring out the constraints. When using DDL update this will cause schema updates with the already existing db type, e.g. {{ALTER TABLE IF EXISTS test ALTER COLUMN state SET DATA TYPE INTEGER;}} even though test.state is already INTEGER.
Workaround to make the system usable for now, because there is no way to disable the new functionality:
{noformat}public class CustomPostgresDialect extends PostgreSQLDialect { @Override public boolean supportsAlterColumnType() { return false; // https://hibernate.atlassian.net/browse/HHH-16531 } }{noformat}
Maybe related to [https://hibernate.atlassian.net/browse/HHH-16498|https://hibernate.atlassian.net/browse/HHH-16498|smart-link] |
|