Max (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate Validator (
https://hibernate.atlassian.net/browse/HV?atlOrigin=eyJpIjoiYmY3NjQ0ODAzO...
) / Bug (
https://hibernate.atlassian.net/browse/HV-1948?atlOrigin=eyJpIjoiYmY3NjQ0...
) HV-1948 (
https://hibernate.atlassian.net/browse/HV-1948?atlOrigin=eyJpIjoiYmY3NjQ0...
) Incorrect validation error for tinyint, but and datetime (
https://hibernate.atlassian.net/browse/HV-1948?atlOrigin=eyJpIjoiYmY3NjQ0...
)
Issue Type: Bug Affects Versions: 8.0.0.Final Assignee: Unassigned Attachments:
hybernate-validation-error-spring-boot.zip Components: validators Created: 10/May/2023
06:02 AM Environment: Spring Boot, Java 17/19, MySQL Priority: Major Reporter: Max (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
See
https://discourse.hibernate.org/t/error-in-native-query-where-column-is-m....
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) (
#TINYINT) ) , but expecting tinyint unsigned default '0' (Types#INTEGER) (
#INTEGER) )
For example, for this table:
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;
this is fine:
@Column(name = "level", columnDefinition = "tinyint")
private int level;
but this results in the exception mentioned above:
@Column(name = "level", columnDefinition = "tinyint UNSIGNED DEFAULT
'0'")
private int level;
Same for datetime, bit and maybe others.
Creating this issue on request by beikov.
hybernate-validation-error-spring-boot.zip (
https://hibernate.atlassian.net/secure/attachment/50369/50369_hybernate-v...
)
(
https://hibernate.atlassian.net/browse/HV-1948#add-comment?atlOrigin=eyJp...
) Add Comment (
https://hibernate.atlassian.net/browse/HV-1948#add-comment?atlOrigin=eyJp...
)
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#100225- sha1:55ea0c5 )