Hibernate Mapping Package

后端 未结 6 1124
深忆病人
深忆病人 2020-11-28 07:34

I\'m using Hibernate Annotations.

In all my model classes I annotate like this:

@Entity
@Table
public class SomeModelClass {
//
}

M

6条回答
  •  遥遥无期
    2020-11-28 08:06

    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

提交回复
热议问题