spring+hibernate mapping class without xml

前端 未结 4 1144
不知归路
不知归路 2021-02-03 10:58

in my applicationContext.xml, this is how I map xml to POJO. how to map directory to class file without required to create xml?



        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 11:57

    And you can further simplify things by converting

    
         
           com.mycompany.sample.domain.Order
           com.mycompany.sample.domain.LineItem
           ...
         
     
    

    to

    
    

    in your AnnotationSessionFactoryBean so now all classes annotated with @Entity in the com.mycompany.sample.domain package will be automatically picked up.

提交回复
热议问题