Hi,

 

I have the following detached criteria that I to convert (if possible) to
QueryOver.

Basically I am trying to get distinct movies where an actor starts with the
letter M.

The following works great

 

var ids = DetachedCriteria.For<Movie>()

     .CreateCriteria("ActorSet")

     .Add(Restrictions.Like("Name", "m%"))

     .SetProjection(Projections.Distinct(Projections.Id()));

 

var movies = session

           .CreateCriteria(typeof(Movie), "a")

           .Add(Subqueries.PropertyIn("a.id", ids))

           .List<Movie>();

 

However I am struggling to do convert this to QueryOver, can anyone help?

 

The above converts into this sql.

 

SELECT this_.Id            as Id0_0_,

       this_1_.Name        as Name0_0_,

       this_1_.Description as Descript3_0_0_,

       this_1_.UnitPrice   as UnitPrice0_0_,

       this_.Director      as Director4_0_

FROM   Movie this_

       inner join Product this_1_

         on this_.Id = this_1_.Id

WHERE  this_.Id in (SELECT distinct this_0_.Id as y0_

                    FROM   Movie this_0_

                           inner join Product this_0_1_

                             on this_0_.Id = this_0_1_.Id

                           inner join Actor actor1_

                             on this_0_.Id = actor1_.MovieId

                    WHERE  actor1_.Name like 'm%' /* @p0 */)

 

I can not seem to fathom how to include the Name.IsLike("m%")

 

Can any one help?

Thanks

Richartd

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to