I need SQL query for the below scenario.
2 tables: price & product
price table has ManyToOne relationship with product(ie, 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.
In this case you can return the product attribute in your query, example:
select p.product from price p where p = :price
Hope this can help. :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.