You may have some other problems there... btw you can load what you need
using session.GetSession(EntityMode.Poco) or, even better, a
stateless-session.

On Sat, Aug 7, 2010 at 5:05 AM, dezzy <[email protected]>wrote:

> Hi all,
>
> I have hooked into NHibernate event model such that, when a entity is
> updated and committed it cause my listener class, which implements
> IPostUpdateEventListener, to be instantiated and the OnPostUpdate
> method to be called. This works fine and is being called the correct
> number of times and I do what I need to do.
>
> The problem arises when I use PostUpdateEvent.Session to read from the
> database.  It is a simple Linq to NHibernate call which returns all
> the products. The list of products is very small, just 5 products, and
> this code is running in a test using a SqlLite file database.
>
>        public void OnPostUpdate(PostUpdateEvent @event)
>        {
>                var result = @event.Session.Linq<Product>().ToList();
>        }
>
> This Linq to NHibernate call causes the OnPostUpdate to be called and
> hence this is the start of our recursive process which naturally leads
> to a stack overflow exception.  I can't understand why OnPostUpdate is
> being called again. I am assuming that this should only be doing a
> read-only operation as these event handlers are being called after a
> commit when all the data have been pushed into the database.  Any
> ideas, or suggestion would be gratefully received.
>
> Kind regards
>
> Shahab
>
> --
> 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.
>
>


-- 
Fabio Maulo

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