Thanks for the suggestion Diego! I'm prepared to do this as a last resort, but if possible I would prefer to avoid restricting how NH loads my entity. As far as I'm concerned, there's nothing unusual about how the entity is loaded, just how its saved.
Is there another way to approach this? Rather than trying to map this stored procedure parameter as a property on my domain object, (which causes problems with loading), is there a way I can get the value of a non-mapped property on my domain object into the INSERT sql? I'm not very familiar with all the NH hooks. On Nov 27, 11:09 pm, Diego Mijelshon <[email protected]> wrote: > I believe you'll also have to specify a custom loader query, in which you > can hardcode the value of that property, like: > > SELECT RealColumn1 AS {myAlias.Property1}, [...] RealColumnN AS > {myAlias.PropertyN}, > 'AConstantValue' AS {myAlias.TheOtherProperty} > > Also, since that property is probably calculated, you might have to mark it > as access="readonly". > > Diego > > On Thu, Nov 26, 2009 at 21:49, Paul Batum <[email protected]> wrote: > > I'm still struggling with this. > > > Am I asking for something that is just not supported in nhibernate? Is > > the stored procedure support limited to cases where there is an exact > > match between the parameters of the stored procedure and the columns > > in the table? > > > On Nov 26, 11:38 am, Paul Batum <[email protected]> wrote: > > > I have an entity that must be inserted using a stored procedure. The > > > stored procedure takes a parameter that does not map to a column in > > > the table, it is used by some logic in the stored procedure. I have no > > > problem with adding a property to my object to hold the value to be > > > passed to the stored procedure - my issue is that I do not know how to > > > tell NHibernate not to attempt to load this property when selecting > > > the entity. > > > > Essentially what I am looking for is in the same equivalent of insert > > > = 'false' but for selects rather than inserts. I tried using > > > Access.Noop but for some reason the property is still included in the > > > select query. Specifying a dummy formula (such as "(0)") prevents an > > > attempt to select the column, but it also prevents the property from > > > being passed as a parameter to the stored procedure (even when I > > > explicitly set insert='true' !). > > > > Thanks for your help, > > > > Paul Batum > > > -- > > > 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.
