I have a class with a variable of type Date, representing a time
@Entity
public class Product implements Serializable {
private static final long serialVersionUID = -7181205262894478929L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int productId;
@NotNull()
private String productName;
@Temporal(TemporalType.DATE)
@DateTimeFormat(style = "yyyy-MM-dd")
@NotNull()
private Date date;
@Temporal(TemporalType.TIME)
@DateTimeFormat(style = "hh:mm")
@NotNull()
private Date time;
....
}
Now I'm trying CRUD methods on Postman, and when I send
{ "productName": "name", "date": "2016-03-10", "time": "10:29" }
I get
400 Bad Request
with a description:
The request sent by the client was syntactically incorrect.
When I try without time, it passes.