I want to retrieve a object based on 2 id´s.
Is this the right critera for this?
var notes = session
.CreateCriteria(typeof(Note))
.Add(Restrictions.Eq("Product", productId))
.Add(Restrictions.Eq("User", userId))
.List<Note>();
does this query fetch the notes that belongs to the user and the product?
and does this criteria:
var comments = session
.CreateCriteria(typeof(Comment))
.Add(Restrictions.Eq("Product", productId))
.Add(Restrictions.Eq("IsOwnComment", 0))
.List<Comment>();
return comments;
return the comments of the products where the boolean value is 0?
have i done this right?
br
This will not work like this. You would need to provide entire entity of association path of Product and User. What you can do is use the special id property:
For second example, use
Restrictions.IsNull("IsOwnComment")