2

We have an SQL Table with a column of type "real" that we are tying to read from using Hibernate. When we try to read from that we are expecting a type float but are getting this error:

found [real (Types#REAL)], but expecting [float (Types#FLOAT)]

Currently we do not have this field annotated with anything else than this?

@Column(name = "BatteryVoltage")
private float batteryVoltage;

However, I expect we might need to use either percision and/or scale. Does hibernate have a solution for this or is it necessary to alter table configuration?

1 Answers1

0

The problem here is that the Hibernate "Validate" step was failing to map the float type to a real type. I don't believe there was actually a run-time error. The solution, as this other post goes into, is to use the @Column(columnDefinition=... annotation.

This solution worked for us:

@Column(name = "BatteryVoltage", columnDefinition = "real")
private float batteryVoltage;