Hello,

I try to persist an entity to database using 

  myEntityRepository.Save(myEntity); // This will end up calling 
ActiveRecordMediator.Save(entity);
  SessionScope.Current.Flush();

By configuring AR to show SQL in output window I see that the update hits 
database but for some reason it isn't committed to DB. Investigating further I 
see that I'm stuck with an open transaction meaning that the whole table is 
locked until my session scope is disposed (upon application exist).

Currently I create a session scope when AR is initialized and leave it there. 
Wrapping the save statement inside a new TransactionScope "fixes" the problem 
but I find that kind of ugly. Manually disposing the current session scope and 
recreating it also works but that is quite ugly as well I think. It feels like 
using a "global" session scope like this isn't really the way to go but if I 
don't create a session scope before starting to throw queries at AR lazy 
loading breaks.

Any hints on how to solve this?

/Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.

Reply via email to