Thymeleaf multi checkboxes works with Long id, but not with Integer

Here is my Entity:


@Table(name = "platforms")



public class Platform implements Serializable {


@GeneratedValue(strategy = GenerationType.IDENTITY)

private Integer id;

@Length(max = 50)

@Column(nullable = false)

private String name;


Command object:



public class AdvancedSearch {

private String phrase;


private Double minPrice;


private Double maxPrice;

private Set pegi;

private Set genres;

private Set platforms = new HashSet<>();


Template in ThymeLeaf:


I want to bind Set to checkboxes, but with Integer id i have

TypeMismatchException: Provided id of the wrong type,

Expected: class java.lang.Integer, got class java.lang.Long.

When I change id to Long in entity and database it works.


Read More »

By: StackOverFlow - 5 days ago

Related Posts