A very beginner question:
I have two classes, Review and ReviewSentences:
public class Review
{
public virtual int recordId { get; set; }
public virtual string reviewerId { get; set; }
public virtual string reviewerName { get; set; }
public virtual string country { get; set; }
public virtual string zipCode { get; set; }
public virtual string reviewProduct { get; set; }
public virtual string reviewText { get; set; }
public virtual string reviewTextLanguage { get; set; }
public virtual double sentimentScore { get; set; }
public virtual bool isScoreRefined { get; set; }
}
pulic class ReviewSentences
{
public virtual int recordId { get; set; }
public virtual int reviewId { get; set; }
public virtual int sentenceId { get; set; }
public virtual string sentence { get; set; }
public virtual double sentimentScore { get; set; }
}
The property ReviewSentences.reviewId is a foreign key referring to Review.recordId. One review can have many sentences (Review:ReviewSentences is 1:Many)
I have been trying for a long time now but unable to replicate the following query in terms of NHibernate with session.CreateCriteria:
select * from Reviews r
left join
ReviewSentences rs
on
r.RecordId = rs.ReviewId
where rs.ReviewId is null
The query gives me all reviews from the Review table that do not have any records in the ReviewSentences table.