I'm following an online tutorial on how to connect a Java class to a my database using hibernate, however I can't find how to create a SessionFactory since I'm not using a hibernate config file, so
SessionFactory factory = new Configuration().configure()
doesn't work for me. I used spring initializr with Web, JPA, MySQL to create the project, and I've set up my application.properties accordingly (so hibernate IS connected to the database)
I've tried looking at some other answers such as Spring Boot - Handle to Hibernate SessionFactory
However the answers are a bit outdated/unclear, I'm trying to create an object and begin a transaction with it in my session in my main.java and the only problem I have is getting the FactorySession to work.
In the tutorial it shows a simple solution of
SessionFactory factory = new Configuration().configure("hibernate-cfg.xml.).addAnnotatedClass(Student.class).buildSessionFactory();
Session session = factory.getCurrentSession();
this creates a sessionfactory from the configuration file, and creates a session from that, How can I achieve the same?