Organizational Research By

Surprising Reserch Topic

using inner join criteria language using -'hibernate-criteria'


using inner join criteria language  using -'hibernate-criteria'

Have two tables : Rating and Books. Rating table has foreign key to the Books table.

These tables are mapped this way :

Books :

 HasMany(x => x.RatingList).Cascade.All().Inverse();      


and the Rating table :

 References(x => x.Books).Column("BookId").Cascade.All();


Have this :

var bks = session.CreateCriteria("Books", "b");


using this restriction for selecting books

 bks.Add(Restrictions.Eq("CategoryId",id));


here is the problem, how to join Rating table ??

                    bks.CreateAlias("b.Rating", "c");
                    bks.List();

                    return PartialView("/Views/Home/_Books.cshtml", bks);


The final result i need is to select all Books but also Rating for them.

Some help ?
    
asked Sep 7, 2015 by rajesh
0 votes
3 views



Related Hot Questions



Government Jobs Opening


...