It is possible,
http://ayende.com/Blog/archive/2009/06/10/nhibernate-ndash-query-only-properties.aspx

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Tue, Jul 21, 2009 at 12:47 AM, Vadim Kazakov <[email protected]>wrote:

>
> NHibernate maps your objects to the database. If you don't have the
> property on your mapping file and hence on your object you can't query
> it without writing SQL. Could you not just have a private field with
> on the class that maps to the column?
>
> On Jul 20, 5:46 am, Niclas Pehrsson <[email protected]> wrote:
> > Im making an article catalog and I need to query my session for just
> > my root articles and catalogs
> >
> > I want to have an property there I can determite IsRoot or IsLeaf or
> > something so I can get only those without a parent, can I solve this
> > by using formula or something? Im thinking that this property will
> > only be used when querying so I will not have this property on my
> > actual object just when searching.
> >
> > Here are my current mapping:
> >
> >   <class name="IArticleCatalogItem" table="ArticleCatalogItem">
> >     <id name="Id" type="System.Guid" unsaved-
> > value="00000000-0000-0000-0000-000000000000">
> >       <generator class="guid" />
> >     </id>
> >
> >     <joined-subclass name="ArticleCategory">
> >       <key column="Id" />
> >       <property name="Name" type="string" access="field.camelcase-
> > underscore" not-null="true" />
> >       <many-to-one name="Parent" class="ArticleCategory"
> > access="field.camelcase-underscore" not-null="false" />
> >       <set name="Items" access="field.camelcase-underscore"
> > inverse="false" cascade="all-delete-orphan">
> >         <key column="ParentId" foreign-
> > key="FK_ArticleCategory_CategoryItem"/>
> >         <one-to-many class="Hogia.Business.IArticleCatalogItem,
> > Hogia.Business"/>
> >       </set>
> >     </joined-subclass>
> >     <joined-subclass name="Article">
> >       <key column="Id"/>
> >       <property name="ArticleNumber" type="string"
> > access="field.camelcase-underscore" not-null="true" />
> >     </joined-subclass>
> >   </class>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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