因為Hibernate采用Anotation的方式配置,故而在applicationContext中sesionFactory應(yīng)該基于
AnnotationSessionFactoryBean,具體代碼如下:
1 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
2 <property name="dataSource" ref="dataSource"></property>
3 <property name="hibernateProperties">
4 <props>
5 <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
6 <prop key="hibernate.show_sql">true</prop>
7 </props>
8 </property>
9 <property name="annotatedClasses">
10 <list>
11 <value>com.donghang.bean.User</value>
12 </list>
13 </property>
14 </bean>
其中User即為采用Anotation映射的實體類。
posted on 2010-02-09 16:24
donghang73 閱讀(386)
評論(0) 編輯 收藏