Vla*_*mir 6 java null hibernate zero
我使用Hibernate访问遗留数据库.对于某些表,不强制执行父子引用完整性,并且long对子表中的某些"父"列使用0值而不是NULL来表示"无父".
long
我仍然希望在@ManyToOne和@OneToMany字段中使用这些关系,但是EntityNotFound因为0值与主表中的任何记录不对应而得到错误.
@ManyToOne
@OneToMany
EntityNotFound
我有什么选择?
JB *_*zet 8
使用NotFound注释:
NotFound
@NotFound(action = NotFoundAction.IGNORE)
见http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#mapping-declaration-manytoone
归档时间:
14 年,10 月 前
查看次数:
4994 次
最近记录:
11 年,4 月 前