我有一个以下示例我想使用多个连接列(下面的类示例)在Car和CarAchievement表之间创建一个懒惰的@ManyToOne关系
@Entity
@Table(name = "CAR")
public class Car implements Serializable {
@Id
@GenericGenerator(name = "SEQ_CAR", strategy = "sequence",
parameters = {
@org.hibernate.annotations.Parameter(
name = "sequence",
value = "SEQ_CAR"
)
}
)
@GeneratedValue(generator = "SEQ_CAR")
@Column(name = "ID")
private Integer id;
@ManyToOne(fetch = FetchType.LAZY)
@NotFound(action = NotFoundAction.IGNORE)
@JoinColumns({
@JoinColumn(name = "region", referencedColumnName = "region", updatable = false, insertable = false),
@JoinColumn(name = "model", referencedColumnName = "model", updatable = false, insertable = false),
@JoinColumn(name = "year", referencedColumnName = "type", updatable = false, insertable = false),
@JoinColumn(name = "type", referencedColumnName = "year", updatable = false, insertable = false)
})
@JsonIgnore
private CarAchievement carAchievement;
}
这种关系工作正常,但似乎不是一个LazyFetch,CAR的每个查询似乎都会自动获取CarAchievement,即使它未指定获取此关系
Hibernate版本:4.3.10.Final