我有一个这样的实体
@Entity
@Table(name = "past_price")
public class PastPrice {
@Id
private String symbol;
@OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
private Set<Price> prices = null;
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public Set<Price> getPrices() {
return prices;
}
public void setPrices(Set<Price> prices) {
this.prices = prices;
}
}
而Price实体是这样的
@Entity
public class Price {
@Id
@Temporal(TemporalType.TIMESTAMP)
private Date date;
private String price;
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
我想做的是,创建一个带有名称的表,past_price它与实体有OneToMany关系。Price我有休眠属性spring.jpa.hibernate.ddl-auto=update,所以每当我运行它时,都会创建 3 个表,1. past_price 2. past_price_prices并且3. price. 但我只是想创建 2 个表past_price和price. 任何帮助,将不胜感激。谢谢
湖上湖
呼啦一阵风
GCT1015
相关分类