java - Open Session in View vs @Transactional -


i had been using @transactional annotations in service layer. resolve error due lazy loading in view had use open session in view filter. after this, without use of @transaction session gets opened , transaction starts. mean @transactions not required? how transactions , roll-backs handled, in service layers?

the javadoc explains it:

this filter makes hibernate sessions available via current thread, autodetected transaction managers. suitable service layer transactions via hibernatetransactionmanager or jtatransactionmanager non-transactional execution (if configured appropriately).

note: filter default not flush hibernate session, flush mode set flushmode.never. assumes used in combination service layer transactions care flushing: active transaction manager temporarily change flush mode flushmode.auto during read-write transaction, flush mode reset flushmode.never @ end of each transaction. if intend use filter without transactions, consider changing default flush mode (through "flushmode" property).


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -