http://blog.csdn.net/flyingfalcon/article/details/8273618
————————————————————————————————————————————————————————
1:
public class AnnotationSessionFactoryBeanextends
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:实例代码
3:实际运用
图:User类
其中类应用了Hibernate和Spring的注解
图:应用中的配置信息
补充:官方文档给出的示例http://static.springsource.org/spring/docs/2.5.6/api/org /springframework/orm/hibernate3/annotation/AnnotationSessionFactoryBean.html
org.springframework.orm.hibernate3.annotation Class AnnotationSessionFactoryBean
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
- All Implemented Interfaces:
- , , , , ,
public class AnnotationSessionFactoryBeanextends implements
Subclass of Spring's standard LocalSessionFactoryBean for Hibernate, supporting JDK 1.5+ annotation metadata for mappings.
Note: This class requires Hibernate 3.2 or higher, with the Java Persistence API and the Hibernate Annotations add-on present.
Example for an AnnotationSessionFactoryBean bean definition:
test.package.Foo test.package.Bar
Or when using classpath scanning for autodetection of entity classes:
- Since:
- 1.2.2 Author:
- Juergen Hoeller See Also:
- , , ,