implements Serializable interface in User class will work.
public class User implements Serializable {
@Id @GeneratedValue protected Long id;
@NotNull @Column(unique = true) protected String customerNr;