在我的模型中,我有这个:
@Entity
public class Plan {
...
@Temporal(TemporalType.TIMESTAMP)
@Column(nullable = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Calendar creationDate;
...
在eclipse调试器中,我在这行中有一个NullPointerException:
plan.setCreationDate(instance);
可能您的plan
对象没有实例化…
这将防止异常:
if (plan != null){
plan.setCreationDate(instance);
}