SpringMvc+Spring+Hibernate的問題總結
1、sessionFactory問題



















在SpringMvc的 Controller類中set方法調用的session名稱為:sessionFactory,如果這里的名稱或者大小寫不一致,那么在xxxx-servlet.xml初始化Controller類時就會出錯。
2、Spring2.0的代理問題
1
< bean id ="txProxyTemplate" abstract ="true" class ="org.springwork.transaction.interceptor.TransactionProxyFactoryBean" >
2
< property name ="transactionManager" ref ="transactionManager" />
3
< property name ="proxyTargetClass" value ="true" />
4
< property name ="transactionAttributes" >
5
< props >
6
< prop key ="get*" > PROPAGATION_REQUIRED,readOnly </ prop >
7
< prop key ="find*" > PROPAGATION_REQUIRED,readOnly </ prop >
8
< prop key ="load*" > PROPAGATION_REQUIRED,readOnly </ prop >
9
< prop key ="save*" > PROPAGATION_REQUIRED </ prop >
10
< prop key ="update*" > PROPAGATION_REQUIRED </ prop >
11
< prop key ="remove*" > PROPAGATION_REQUIRED </ prop >
12
</ props >
13
</ property >
14
</ bean >

2

3

4

5

6

7

8

9

10

11

12

13

14

在Spring2.0后,特別是在使用了 SpringSide 框架后,必須在代理中設置 <property name="proxyTargetClass" value="true"/>,否則就會出錯。
posted on 2006-12-16 22:51 常言笑 閱讀(1559) 評論(0) 編輯 收藏 所屬分類: JAVA/J2EE