2011-06-15 5 views
0

의사 코드로 설명하려고 시도합니다.트랜잭션에 대한 nhibernate 세션 문제

는 두 개의 세션 S1과 S2

INT totalEntity = 0이있어; 내가 S2를 실행하면 s1.Transaction가 최선을 다하고 때문이

Thread1 
{ 
s1.BeginTransaction(); 
loop (infinite) 
{ 
    totalEntity = s1.List<Entity>().Count(); 
} 
s1.EndTransaction(); 
} 


s2.BeginTransaction(); 
s2.Insert<Entity>(); 
s2.EndTransaction(); 

는 totalEntity는 여전히 제로이다. 루프에서 실제 totalEntity를 1로 어떻게 얻을 수 있습니까?

+0

어떤 데이터베이스를 사용하고 있습니까? 어떤 트랜잭션 격리 수준입니까? –

답변

0

flush를 호출하면 db가 업데이트됩니다.

0

트랜잭션이 루프 내부에 있으면 더 좋을 것 같습니다.

관련 문제