Sping注記接続エラー:No Session found for current thread

1510 ワード

詳細
Sping 3+Hibernate 4統合フル注釈方式を使用する場合、データを調べるときに常にエラーが発生します:No Session found for current thread.
web.xmlにも以下のような構成が加わっていますが、やはり無理です.
openSessionInViewFilter
org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
singleSession
true
openSessionInViewFilter
*.do
何度もテストしたところ、上記のフィルタはstrutsフィルタの後に置かれているので、前に置かなければならないことがわかりました.フィルタの実行順序は構成順に順次実行されるからです.
 

	
		openSessionInViewFilter
		org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
		
			singleSession
			true
		
	
	
		openSessionInViewFilter
		*.do
	
	
	
	
		struts2
		
			org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
		
			config
			struts-default.xml,struts-plugin.xml,../config/struts-config.xml
		
	
	
		struts2
		*.do
	

 
この問題は長い間やっていた.お父さん.