当我尝试更新父类对象时,我在数据库中获取了一些空白字段
这是我尝试过的一些步骤,但仍然无法解决
@Entity
@Table(name="stores")
public class Store{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@OneToOne(mappedBy = "store", fetch = FetchType.LAZY,cascade=CascadeType.ALL )
@JsonManagedReference
private Config config;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public config getConfig() {
return config;
}
public void setConfig(Config config) {
this.config = config;
}
}
@Entity
@Table(name = "config")
public class Config {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@OneToOne(fetch = FetchType.EAGER,cascade=CascadeType.ALL)
@JoinColumn(name = "store_id")
@JsonBackReference
private Store store;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Store getStore() {
return store;
}
public void setStore(Store store) {
this.store = store;
}
}
我从商店类中删除了cascade = CascadeType.ALL,但仍然无法解决此问题