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

Here is my Entity:

@Entity

@Table(name = "platforms")

@Data

@NoArgsConstructor

public class Platform implements Serializable {

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

private Integer id;

@Length(max = 50)

@Column(nullable = false)

private String name;

}

Command object:

@Data

@NoArgsConstructor

public class AdvancedSearch {

private String phrase;

@PositiveOrZero

private Double minPrice;

@PositiveOrZero

private Double maxPrice;

private Set pegi;

private Set genres;

private Set platforms = new HashSet<>();

}

Template in ThymeLeaf:





Platformy:











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.

Another...

Read More »

By: StackOverFlow - 5 days ago

Related Posts