I would approach the problem in a completely different manner.
1. no long running sessions
2. only use 2nd level cache in edge cases as a last resort
3. for multi-step operations/commands I would use an intermediate DTO
to store updates. When the user clicks "save" is when i would alter
the domain objects. this makes undoing changes much easier. simply
abandon the DTO.

if you do continue down this path are all your session calls happening
within a transaction? Proper use of NH dictates that all operations,
both read and write, should happen within at transaction. This is
critical for client POIDs, proper UOW management and 2nd level cache.

On Apr 29, 2:05 pm, tz <[email protected]> wrote:
> Hi guys,
>
> I'm working with a long running session which contains all my required
> data. Further, I use level 2 cache intensively, to cache that
> information. I let my user edit this data directly using UI controls.
>
> The user can decide to cancel the modifications, which I though I'd
> easily solve with performing a ISession.Refresh(..) on the aggregate
> root of the changed entity.
>
> However, it turns out that Refresh(...) always goes to the database to
> refetch the data, even if the data is available in second level cache
> (tested that the data is there using a second ISession, which returned
> the data without a database hit).
>
> Is there a way to refresh entity from data in the second level cache?
>
> I don't want to use Evict+Load, as I will then get a new instance
> (Refresh(...) updates the same instance).
>
> Thanks
>
> --
> 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 
> athttp://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.

Reply via email to