Hibernate annotation @NotFound

解决异常:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists


原因:多对一映射时,一方表中对应的数据不存在才抛出的。

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID", nullable = false, insertable = false, updatable = false)
	@NotFound(action = NotFoundAction.IGNORE)
	public DcUserInfo getDcUserInfo() {
		return this.dcUserInfo;
	}

你可能感兴趣的:(annotation)