关于hibernate(jpa)报not-null property references a null or transient value的问题
2012-10-29 15:38
465 查看
最近在做一个购物网站,在其中遇到一个问题:javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.shop.bean.lmm.Lmm.time我弄了好长时间,才发现问题的所在。
原来,我在写
private Date time = new Date();
@Temporal(TemporalType.TIMESTAMP) @Column(nullable=false)
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
这部分代码时将private Date time = new Date(); 写成了private Date time;我忘记了new一个Date类型的对象,导致了一天多的郁闷,而且大部分的网上文档不给力,所以在写代码时一定要认真。
原来,我在写
private Date time = new Date();
@Temporal(TemporalType.TIMESTAMP) @Column(nullable=false)
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
这部分代码时将private Date time = new Date(); 写成了private Date time;我忘记了new一个Date类型的对象,导致了一天多的郁闷,而且大部分的网上文档不给力,所以在写代码时一定要认真。
相关文章推荐
- hibernate级联保存问题,出错not-null property references a null or transient value
- hibernate级联保存问题,出错not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- 商品订购系统时出现的问题汇总 not-null property references a null or transient value 等
- 关于:not-null property references a null or transient value
- Java开发中,试用hibernate建立关联时出现:not-null property references a null or transient value异常的原因
- org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
- hibernate异常:not-null property references a null or transient value
- not-null property references a null or transient value: 等关于cinema项目bug
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value
- org.hibernate.PropertyValueException: not-null property references a null or transient value : xxx
- Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient va
- org.hibernate.PropertyValueException: not-null property references a null or transient value: model.
- org.hibernate.PropertyValueException: not-null property references a null or transient value:
- 错误:org.hibernate.PropertyValueException:not-null property references a null or transient value
- java中的异常not-null property references a null or transient value
- not-null property references a null or transient value
- not-null property references a null or transient value解决方案
- not-null property references a null or transient value