• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we create a sessionFactory from a combination of Annotated Classes and Hbm files.

 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is there a way in which we can create a SessionFactory in hibernate using both Annotated Classes and HBM files.

Thanks

Rahul
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul Babbar wrote:Hi All,

Is there a way in which we can create a SessionFactory in hibernate using both Annotated Classes and HBM files.

Thanks

Rahul


1) Yes, if you are using just Hibernate, then you list the .hbm files and classes that are annotated in your hibernate.cfg.xml
2) If you are using JPA and Hibernate is your implementation, then you but it in your persistence.xml file, and I don't think they will be .hbm, so I assume #1 is what you have
3) If you are integrating it with Spring, then it would be in a <bean> tag for an implement of LocalSessionFactoryBean or JPA's Factory Bean as property values to those Spring FactoryBean classes.

Mark

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic