ок, спасибо за все подсказки! сработало следующее:
public class HibernateUtil {
...
public static SessionFactory createSessionFactory(Properties p)
{
try {
// Create the SessionFactory from hibernate.cfg.xml
Configuration cfg = new AnnotationConfiguration().configure();
if (p != null)
cfg.addProperties(p);
return cfg.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);
}
}
}
тогда в моем приложении код:
private void init() {
Properties p = new Properties();
p.setProperty("hibernate.hbm2ddl.auto", "create");
Session session = HibernateUtil.createSessionFactory(p)
.getCurrentSession();
session.beginTransaction();
session.getTransaction().commit();
session.getSessionFactory().close();
System.out.println("should be initialized....");
}