java - Transaction with request scope with MyBatis and Spring -
is there way setup mybatis springmvc have 1 transaction whole http request? there hibernate opensessioninviewfilter in mybatis or should write own filter fulfill such behavior?
you confused notions "session" , "transaction". osiv opens session, in 1 session several transactions may coexist. should put @transactional attributes services used controllers, depending on business requirements.
moreover, 1 big transaction anti-pattern. ideally have read-write transaction user's actions, , read-only transaction build response user. saves resources, because database locks taken inserts/updates released earlier.
Comments
Post a Comment