【发布时间】:2011-04-17 20:41:26
【问题描述】:
如果一个字段被注解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;
}
【问题讨论】:
标签: java jpa jakarta-ee eclipselink