I have the following tables (simplified):
Product(Id, Name)
OrderItem(Id, ProductId)
...which map to the following classes:
Product {Id, Name}
OrderItem {Id, Product (many-to-one)}
I need the (N)Hibernate syntax to retrieve the Products that appear in Orders.
The SQL would be something like:
select *
from Product
where exists (
select *
from OrderItem
where OrderItem.ProductId = Product.Id)
How do I create the Criteria?