Hi everyone,
I am following the guide for Auto CRUD: Auto CRUD component | Vaadin components and have an issue with UUIDs when using a Custom Service as mentioned towards the bottom.
The example uses a record with a Long as an id:
public record ProductDto(Long id, String name, String category, double price) {
I am using UUIDs in the database and hence my record looks like this:
public record ProductDto(UUID id, String name, String category, double price) {
I am able to edit existing entries, but not able to create new ones. When I do this, I get the following error:
com.fasterxml.jackson.databind.JsonMappingException: Invalid UUID string:
I am assuming this is because the id parameter is empty when creating a new entry and an empty String can’t be translated to a UUID.
Does anyone have a pointer in the right direction?
In case you are wondering why I am using a custom service: My JPA entities reference each other and that gives Jackson a problem. If there is a better way to avoid this without DTOs etc, I am also happy to hear about it. But the UUID problem, might pop up somewhere else again, so would be happy to hear how to fix this.
Thank you very much!