I have simply 3 tables like:
product
.----------
id
name
category
.----------
id
name
product_category
.----------------------
p_id
c_id
I want to get a list of products where the products have category of id=3.
I am confused about how to write a hibernate criteria
for this. Any help would be appreciated.
Thanks
Criteria c = session.createCriteria(Product.class, "product");
c.createAlias("product.categories", "category");
c.add(Restrictions.eq("category.id", 3));