我写的第一个版本为nullable = false;
@Entity
@Table(name = "ORGANIZATION")
@org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
public class Organization extends AbstractEntity {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name = "HOST_ID")
private Host host;
然后我需要HOST_ID
接受null
值;
但是仅更改为nullable = true
不会影响数据库表。
如何直接删除nullable = false
约束而不访问数据库?