I have an Entity like this
@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;
}
}
And the Price
entity is like this
@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;
}
}
What I am trying to do is, create a table with name past_price
and it has OneToMany
relationship with Price
entity. I have hibernate property spring.jpa.hibernate.ddl-auto=update
so whenever I run this there are 3 tables created 1. past_price
2. past_price_prices
and 3. price
. But I am only trying to create 2 tables past_price
and price
. Any help would be appreciated. Thanks