stretch-a-lot
stretch-a-lot

Reputation: 25

Spring JPA solution to Thymeleaf returning Strings instead of List<Object>

I have created a Thymeleaf form and am attempting to map a field with multiple inputs to a List in a OneToMany entity. However, I keep getting the below error:

default message [Failed to convert property value of type 'java.lang.String' to required type 'project.model.Prop' for property 'propList[0]'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'project.model.Prop' for property 'propList[0]': no matching editors or conversion strategy found]

Many others on this site have faced a similar error, and I have found someone facing an almost identical issue here. However, for that post, one answer provides a non-JPA solution. At the same time, the answer says that there is a JPA way to handle the issue, but no additional details are provided.

Can anyone explain how to resolve that post's situation with JPA?

Upvotes: 0

Views: 87

Answers (1)

Donkassu
Donkassu

Reputation: 46

If you want to solve the issue with the Spring Data JPA, you must bring the List<Prop> List-object from its repository. Then, you would not need to make your own custom converter to solve the issue.

Upvotes: 1

Related Questions