Hibernate version: 1.20
Suppose I have a class with 3 properties A, B, C. I want to select all properties except one (C for example). If I do:
Code:
IList myClasses = session.CreateSQLQuery(@"select A as {c.A}, B as {c.B} from MyClass c"
.AddEntity("c", typeof(MyClass))
.List();
I've got
IndexOutOfRangeException (C not specified). If I do:
Code:
IList myClasses = session.CreateSQLQuery(@"select A as {c.A}, B as {c.B}, null as {c.C}"
.AddEntity("c", typeof(MyClass))
.List();
I've got
QueryException:
SQL queries only support properties mapped to a single column - property [C] is mapped to 3 columns. Because unfortunately the C property is mapped to 3 columns (what a surprise!).
How can I skip the selecting of such properties and why must I supply names for all that properties if I need to select only some of them?
Thanks.