properties hibernate.cfg.xml <p>how i can load properties from <code>hibernate.cfg.xml</code> as String to my java program?</p> <p>I want to create <code>IDataBaseTester</code> with this properties or tell me another way for create <code>IDataBaseTester</code> from <code>hibernate.cfg.xml</code></p> <p><code>HibernateUtil</code> for create session </p> <pre><code>public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { // Close caches and connection pools getSessionFactory().close(); } } </code></pre>