如果一个字段被注释为
insertable=false, updatable=false
,这不意味着你既不能插入值也不能修改现有的值吗?你为什么要这样做呢?@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToMany(mappedBy="person", cascade=CascadeType.ALL)
private List<Address> addresses;
}
@Entity
public class Address {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne
@JoinColumn(name="ADDRESS_FK")
@Column(insertable=false, updatable=false)
private Person person;
}
GENERATED ALWAYS AS (height * width * length) VIRTUAL
) - Zyl