Java Hibernate-如何删除nullable = false约束?

时间:2018-08-14 08:27:08

标签: hibernate

我写的第一个版本为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约束而不访问数据库?

0 个答案:

没有答案