[JIRA] (HHH-16578) Incorrect validation error for tinyint, but and datetime
by Steve Ebersole (JIRA)
Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOThhMzY2YWY2... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16578?atlOrigin=eyJpIjoiOThhMz... ) HHH-16578 ( https://hibernate.atlassian.net/browse/HHH-16578?atlOrigin=eyJpIjoiOThhMz... ) Incorrect validation error for tinyint, but and datetime ( https://hibernate.atlassian.net/browse/HHH-16578?atlOrigin=eyJpIjoiOThhMz... )
Change By: Steve Ebersole ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
See [ https://discourse.hibernate.org/t/error-in-native-query-where-column-is-m... |https://discourse. hibernate.org/t/error-in-native-query-where-column-is-mapped-twice/6781/7].
For some MySQL data types full column definition results in the following exception (that stops a spring boot application from starting):
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [level] in table [test_data]; found [tinyint (Types#TINYINT)], but expecting [tinyint unsigned default '0' (Types#INTEGER)]
For example, for this table:
{noformat} CREATE TABLE `test_data` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`level` tinyint unsigned DEFAULT '0',
`delete_date` datetime DEFAULT '1970-01-01 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; {noformat}
this is fine:
{noformat} @Column(name = "level", columnDefinition = "tinyint")
private int level; {noformat}
but this results in the exception mentioned above:
{noformat} @Column(name = "level", columnDefinition = "tinyint UNSIGNED DEFAULT '0'")
private int level; {noformat}
Same for datetime, bit and maybe others.
Creating this issue on request by beikov.
[^hybernate-validation-error-spring-boot.zip]
( https://hibernate.atlassian.net/browse/HHH-16578#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16578#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=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:11e4e77 )
2 years, 11 months