我有一个这样的实体
@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;
}
}
我试图做的是,创建一个带有名称的表,它与实体有关系。我有休眠属性,所以每当我运行这个时,都会创建3个表和.但我只是试图创建2个表和.任何帮助将不胜感激。谢谢past_priceOneToManyPricespring.jpa.hibernate.ddl-auto=update1. past_price2. past_price_prices3. pricepast_priceprice
12345678_0001
倚天杖
偶然的你
相关分类