应用此更新数据库脚本时收到此错误。
default expression needed in statement [alter table WATERSCHEME_LOCATION add column LGA_ID integer not null ]
LGA_ID 是与位置表关联的列,LGA_ID 设置为强制。但是当我删除强制项时,我可以更新脚本。
@Table(name = "WATERSCHEME_SCHEME_C")
@Entity(name = "waterscheme$Scheme_c")
public class Scheme_c extends BaseIntegerIdEntity {
private static final long serialVersionUID = -5886267876250540580L;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LGA_NAME_ID")
protected Lga lgaName;"""
这是我的位置表
/*
* Copyright (c) 2016 water-scheme
*/
package com.company.waterscheme.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.haulmont.cuba.core.entity.BaseIntegerIdEntity;
import com.haulmont.chile.core.annotations.NamePattern;
/**
* @author samuel.thampy
*/
@NamePattern("%s|locationName")
@Table(name = "WATERSCHEME_LOCATION")
@Entity(name = "waterscheme$Location")
public class Location extends BaseIntegerIdEntity {
private static final long serialVersionUID = 8201565825728955033L;
@Column(name = "LOCATION_NAME", nullable = false)
protected String locationName;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "LGA_ID")
protected Lga lgaId;
public void setLocationName(String locationName) {
this.locationName = locationName;
}
public String getLocationName() {
return locationName;
}
public void setLgaId(Lga lgaId) {
this.lgaId = lgaId;
}
public Lga getLgaId() {
return lgaId;
}
}
有人可以帮我为什么要设置默认值吗?