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


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

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

                    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

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.