Guest User

Untitled

a guest
Mar 7th, 2019
26
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None
  1. package com.andu033.restapi.basiccrud;
  2.  
  3. import org.hibernate.SessionFactory;
  4. import org.hibernate.cfg.Configuration;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.context.annotation.Bean;
  7. import org.springframework.stereotype.Component;
  8.  
  9. @Component
  10. public class HibernateUtil {
  11.  
  12. public static SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
  13.  
  14. public static SessionFactory getSessionFactory() {
  15. return sessionFactory;
  16. }
  17. @Bean
  18. public SessionFactory b() {
  19. return new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
  20. }
  21.  
  22. }
RAW Paste Data Copied