SasseMan 49 Junior Poster

Hi, Im writing a java app that uses hibernate for DB stuff. The thing is that it takes some time to start hibernate, and I would like to have a progress bar to show the loading procedure, and maybe print what hibernate is outputting

public class HibernateUtil {
    private static final SessionFactory sessionFactory;

    static {
        try {
            // Create the SessionFactory from standard (hibernate.cfg.xml) 
            // config file.
            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

        } catch (Throwable ex) {
            // Log the exception. 
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}

Here is where the loading takes place, more precisely the line...

sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();

Does anyone have an idea of how to make a progress bar for this in java?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.