See [ https://discourse.hibernate.org/t/error-in-native-query-where-column-is-mapped-twice/6781/7 |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] |
|