Excellent, that worked a treat. Thank you very much

On Jun 25, 1:09 pm, John Rayner <[email protected]> wrote:
> We use something like this:
>
>   public IList<ContactHistoryEvent> GetMyEntities(int argument)
>   {
>     IQuery query = _session.GetNamedQuery(queryName);
>     query.SetParameter(0, argument);
>     return query.List<ContactHistoryEvent>();
>   }
>
> Cheers,
> John
>
> On Jun 25, 11:39 am, JamesSpibey <[email protected]> wrote:
>
> > Hi John,
>
> > Thanks for the reply. Yes, I need to pass parameters into the TVF,
> > hence why I though it couldn't be used in a join.
>
> > Thanks for your example. I'm new to the <sql-query> tag - are those
> > parameters you are passing into it? Do you have a simple example of
> > how you would call that query from within nHibernate?
>
> > Thanks
>
> > James
>
> > On Jun 24, 9:43 pm, John Rayner <[email protected]> wrote:
>
> > > If you are passing parameters into your TVF (and into CONTAINSTABLE)
> > > then it will need to be a custom SQL query.  If you aren't passing any
> > > parameters in then you have the option of using a view instead of a
> > > TVF.
>
> > > Out of interest, why do think that a parameter-less TVF won't work for
> > > joins and associations?  I would think you could just put it in the
> > > table attribute of your <class> mapping.
>
> > > If it's any help, here's one example of how we use a TVF to load up
> > > some entities:
>
> > >   <class name="Beacon.Business.ContactHistory.ContactHistoryEvent,
> > > Beacon.Business"
> > >                    table="ContactHistoryEvent"
> > >                    lazy="false"
> > >                    mutable="false">
> > >      <!-- property mappings here -->
> > >   </class>
>
> > >   <resultset name="DefaultContactHistoryMapping">
> > >     <return
> > > class="Beacon.Business.ContactHistory.ContactHistoryEvent,Beacon.Business">
> > >       <!-- return-property translations here -->
> > >     </return>
> > >   </resultset>
>
> > >   <sql-query name="ContactHistoryEventOutput" resultset-
> > > ref="DefaultContactHistoryMapping">
> > >     <![CDATA[ SELECT * FROM ContactHistoryEventOutput ( ?, DEFAULT,
> > > DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT ) ]]>
> > >   </sql-query>
>
> > > In a couple of places, we've also used the output of TVFs as the
> > > source for collections from other entities.
>
> > > One word of warning ... NHib places great emphasis on the identity of
> > > an entity.  You need to make sure the output of your TVF respects
> > > this, if there is any possibility of the TvF being called twice within
> > > the same session.
>
> > > Cheers,
> > > John
>
> > > On Jun 23, 1:57 pm, JamesSpibey <[email protected]> wrote:
>
> > > > Hi,
>
> > > > We need to use the Sql Server CONTAINSTABLE() function from NHibernate
> > > > and the way we have done this in the past is to wrap it in a Table
> > > > Value Function (TVF) and then join on this.
>
> > > > Is there a way to use TVFs from NHibernate to map to a type? We will
> > > > need to join on the TVF and create associations etc so I don't think a
> > > > custom SQL query will do it
>
> > > > Thanks
>
> > > > James- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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