Henning Rohlfs (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNmMzMzk5MmEw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiNmMzMz...
) HHH-16531 (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiNmMzMz...
) Hibernate DDL validation generates false positives (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiNmMzMz...
)
Change By: Henning Rohlfs (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The changes introduced in
[
https://hibernate.atlassian.net/browse/HHH-15870|https://hibernate.atlass...]
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.atlass...]
(
https://hibernate.atlassian.net/browse/HHH-16531#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16531#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100223- sha1:3b773b8 )