1:
public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean
Subclass of Spring's standard LocalSessionFactoryBean for Hibernate3, supporting JDK 1.5+ annotation metadata for mappings. Requires the Hibernate3 Annotation add-on to be present.
2:实例代码
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="annotatedClasses">
<list>
<value>test.package.Foo</value>
<value>test.package.Bar</value>
</list>
</property>
<property name="annotatedPackages">
<list>
<value>test.package</value>
</list>
</property>
</bean>
3:实际运用
图:User类
其中类应用了Hibernate和Spring的注解
图:应用中的配置信息