I need SQL query for the below scenario.
2 tables: price & product
price table has ManyToOne relationship with product(i.e., many prices were applicable to one product).
Now I need a query to get only the product details which available in price table.
Note: Using hibernate, I have specified in price as
@ManyToOne @JoinColumn(name = "PRODUCT_ID") private Product product;
But I don't specify OneToMany in product.
Productclass. If you are willing to keep track of product's price in several shops (for example) you should keep it inMapon some 'Store' class. These are just good manners for anyone who is going to maintain your code.