Below is HQL query that I use to obtains all columns f开发者_如何学编程rom OrderDetail table and Name column from Item table.
Could I do this using QueryOver in which I do not need to manually list all OrderDetail's columns in the Select clause of QueryOverProjectionBuilder statement, instead? Is there anyway to use "Select *" in QueryOver?
IList<OrderDetail> lstOD = Session.GetISession().CreateQuery("Select d, i.Name from OrderDetail d inner join d.Item i Where d.Order.Id = 1");
Appreciate your help.
There is currently no way to do a SELECT *
using QueryOver
, unfortunately. This has been discussed on the NH Google Group a few times. If you really want something like this, then you can extend QueryOver
to iterate over all of the properties you've mapped and build up a projection list under the covers.
精彩评论