How do you translate Hibernate class mappings to a Spring application context?

前端 未结 3 680
滥情空心
滥情空心 2021-02-02 03:12

How do you configure the Hibernate class mappings of class org.springframework.orm.hibernate3.LocalSessionFactoryBean in the Spring application context? I want to move the sess

3条回答
  •  遇见更好的自我
    2021-02-02 03:35

    If you're using JPA-annotated classes, you can use AnnotationSessionFactoryBean instead of LocalSessionFactoryBean, and inject the classes directly into the Spring bean:

    
        
        
           
               com.company.app.common.model.Account
               com.company.app.common.model.AccountCategory
               com.company.app.common.model.AssetType
               com.company.app.common.model.Book
               com.company.app.model.AssetTypeCategory      
           
        
        
           
              Queries.hbm.xml
           
                
        
            
                org.hibernate.dialect.Oracle10gDialect
            
        
    
    

提交回复
热议问题