I\'m using Hibernate Annotations.
In all my model classes I annotate like this:
@Entity
@Table
public class SomeModelClass {
//
}
M
I just come across this problem, and find out there seems an out of box solution for this. My integration is not out yet, will update this later.
From the Javadoc, especially the packagesToScan
part:
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
Subclass of Spring's standard LocalSessionFactoryBean for Hibernate, supporting JDK 1.5+ annotation metadata for mappings.
Note: This class requires Hibernate 3.2 or later, 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