class HibernateUtil {

  private static final SessionFactory SESSIONFACTORY = buildSessionFactory();

  private static SessionFactory buildSessionFactory() {<FILL_FUNCTION_BODY>}

  public static SessionFactory getSessionFactory() {
    return SESSIONFACTORY;
  }

}


    // configures settings from hibernate.cfg.xml
    final var registry = new StandardServiceRegistryBuilder().configure().build();
    try {
      return new MetadataSources(registry).buildMetadata().buildSessionFactory();
    } catch (Exception ex) {
      StandardServiceRegistryBuilder.destroy(registry);
      LOGGER.error("Initial SessionFactory creation failed.", ex);
      throw new ExceptionInInitializerError(ex);
    }
  
<no_super_class>