12. What are the most common methods of Hibernate configuration?


The most common methods of Hibernate configuration are:

  • Programmatic configuration
  • XML configuration ('hibernate.cfg.xml')

Look at the sample below

Configuration cfg = new Configuration();
File file = new File('hibernate.cfg.xml'
);
cfg.configure(file);
SessionFactory sessionFactory = cfg.buildSessionFactory();

3 comments: