用注解设置属性的默认值时
使用

@Temporal(TemporalType.TIMESTAMP)
@Column(updatable = false,nullable=false,length=20)
public Date getPubDate() {
return pubDate;
}
但是老是出错,插入数据库的值老为空
找了很久,才发现犯了最基本的错误,初始化对象时没有设置一个默认值
private Date pubDate=new Date();

相关文章:

  • 2023-02-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-10-17
  • 2022-02-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
相关资源
相似解决方案