Issue
I have Spring-boot(with Kotlin
) project and for testing purposes I'm using H2 database.
Field
in my entity
@Column
var cargoWeightAmount: Float? = null
DDL
part from flyway
script
create table pi_picargo_awb (..., cargo_weight_amount float, ...)
If I have hibernate.ddl-auto: update
there is no problems, mapping works fine. But if I have hibernate.ddl-auto: validate
then I'm getting this error -> Schema-validation: wrong column type encountered in column [cargo_weight_amount] in table [pi_picargo_awb]; found [real (Types#REAL)], but expecting [float4 (Types#FLOAT)]
I tried to replace float
with real
, float4
it did not help me.
Solution
I fixed the problem by using BigDecimal type for entity and Number type for database
Answered By - lalilulelo_1986