Что не так с этим LocalTime
Проект Spring + Thymeleaf Вот описание в сущности:
@Entity
public class CarEntity {
...
@Column(name = "time_oot", nullable = false)
private LocalTime timeOut;
}
Читаем время в формате LocalTime с HTML формы. Пока был вывод без секунд, все работало. Т.е. форма ввода была такого вида:
<label for="inputime">Время</label>
<input type="time" class="form-control" id="inputime" placeholder="Задайте время" max="0:50:00" min="0:00:01" value="00:00" th:field="*{timeOut}" required>
Но мне не нужны часы на форме, а только минуты и секунды, я добавил на форму секунды:
<label for="inputime">Время</label>
<input type="time" class="form-control" id="inputime" placeholder="Задайте время" max="0:50:00" min="0:00:01" value="00:00:00" step="1" th:field="*{timeOut}" required>
Field error in object 'CarEntity' on field 'timeOut': rejected value [00:12:25];
codes
[typeMismatch.CarEntity.timeOut,typeMismatch.timeOut,typeMismatch.java.time.LocalTime,typeMismatch];
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [CarEntity.timeOut,timeOut];
arguments []; default message [timeOut]];
default message [Failed to convert property value of type 'java.lang.String' to required type 'java.time.LocalTime' for property 'timeOut';
nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String]
to type [@javax.persistence.Column java.time.LocalTime] for value '00:12:25'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [00:12:25]]]
В чем проблема?