You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: I would like to use the new java features like records and eventually value objects to reduce memory footprint in my applications with thymeleaf models. I'm using spring boot 3.2(M3) with thymeleaf-starter As an example:
<formaction="#" th:action="@{/updateExistingEmployee}" th:object="${employeeToUpdate}"
method="POST"><!-- Add hidden form field to handle update --><inputtype="text" th:field="*{id}"/>
<inputtype="text" th:field="*{name}" class="form-control mb-4 col-4"><inputtype="text" th:field="*{email}" class="form-control mb-4 col-4"><buttontype="submit" class="btn btn-info col-2"> Update Employee</button></form>`
employeeToUpdate is mapped to the record in the controller model. When I try to update an already existing value and submit the form, the employee model comes with it's empty constructor values instead of the populated ones. I understand why this is happening, because of the immutable nature of records/lack of setters, but I would like to know if there are any plans to support records/value objects in the future for stuff like this. I would like to avoid intermediary normal class dto's just for updating. It defeats the purpose of using them in the first place.
Thank you in advance!
The text was updated successfully, but these errors were encountered:
Context: I would like to use the new java features like records and eventually value objects to reduce memory footprint in my applications with thymeleaf models. I'm using spring boot 3.2(M3) with thymeleaf-starter As an example:
employeeToUpdate is mapped to the record in the controller model. When I try to update an already existing value and submit the form, the employee model comes with it's empty constructor values instead of the populated ones. I understand why this is happening, because of the immutable nature of records/lack of setters, but I would like to know if there are any plans to support records/value objects in the future for stuff like this. I would like to avoid intermediary normal class dto's just for updating. It defeats the purpose of using them in the first place.
Thank you in advance!
The text was updated successfully, but these errors were encountered: