Hey,

This is my first time using criteria and projections so I could easily be 
missing something.  The following code I have without the order works just 
fine:

var list = database.Session.CreateCriteria(typeof(DeviceType))
>
>                 .SetProjection(Projections.ProjectionList()
>
>                     .Add(Projections.Property("Id"), "Id")
>
>                     .Add(Projections.Property("Model"), "Model")
>
>                 )
>
>                 
>> .SetResultTransformer(Transformers.AliasToBean(typeof(DeviceType)))         
>>        
>
>                 .List<DeviceType>();
>
>
>>             return list;
>
>
However if I add an order like in the following code:

var list = database.Session.CreateCriteria(typeof(DeviceType))

                .SetProjection(Projections.ProjectionList()

                    .Add(Projections.Property("Id"), "Id")

                    .Add(Projections.Property("Model"), "Model")

                )

                .AddOrder(Order.Asc("Model"))

                
> .SetResultTransformer(Transformers.AliasToBean(typeof(DeviceType)))         
>        

                .List<DeviceType>();


>             return list;


I receive the following error:
NHibernate.ADOException
{"could not execute query\r\n[ SELECT this_.ID as y0_, this_.Model as y1_ 
from DeviceTypes this_ ORDER BY y1_ asc ]\r\n[SQL: SELECT this_.ID as y0_, 
this_.Model as y1_ from DeviceTypes this_ ORDER BY y1_ asc]"}
InnerException
{"No value given for one or more required parameters."}

Anybody have any ideas?  It would be greatly appreciated.

Thanks 

>  

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/hKwnHMfEUQAJ.
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