If a property is unmapped, from NHibernate's perspective it doesn't exist. A reasonable alternative is creating a query only property (see http://ayende.com/Blog/archive/2009/06/10/nhibernate-ndash-query-only-properties.aspx) which replicates the logic of Age, but in SQL. It's a bit of a hack, but at least it's transparent to your queries.
Diego On Wed, Apr 28, 2010 at 18:29, Matt Mangold <[email protected]>wrote: > I would like to know if it is possible to create a query where I add > an unmapped property to my projected output. > > Here is an example > > I have a class called Person > > Person has 3 properties > Name > Birthday > Age > > Name and Birthday are mapped to the database, and Age is calculated > based on today's date, hence it is not mapped. > > When I create a criteria query and I add Age to my projections list, I > get an error when I execute the query: > > NHibernate.QueryException: could not resolve property: Age > > Does anyone know if I am able to put unmapped properties from my > entity into my query projections? > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
