|
Hibernate version: Version 3.x
Hi !
I was wondering if it's possible to get status when hibernate is loading. I would like to create splash screen on startup of my application (I have standalone java application), with progress bar showing how longer it will take to load whole hibernate context.
As you can see (down on how I load context) I use several hbm.xml files, which all contain several classes. I would need to get from hibernate progress status (in procent) or a way to load each hbm.xml separately. I don't exact % but just an estimate.
Problem is that on slower computers this application can take some time to load (on my development machine this is quite fast, but on some others it could take quite some time).
If you have any idea how I could do this, please let me know.
Andy
This is how I load Hibernate context (database), this is just part of code, but this is code that does startup of database and hibernate:
----
public void openHibernate()
{
SessionFactory sessions = getConfiguration().buildSessionFactory();
m_session = sessions.openSession();
}
public Configuration getConfiguration()
{
try
{
Configuration cfg = new Configuration()
.addResource("A1.hbm.xml")
.addResource("D1.hbm.xml")
.addResource("G1.hbm.xml")
.addResource("P1.hbm.xml")
.addResource("P2.hbm.xml")
.addResource("M1.hbm.xml")
.addResource("S1.hbm.xml")
.setProperty("hibernate.dialect", dialect)
.setProperty("hibernate.connection.driver_class", conn_driver_class)
.setProperty("hibernate.connection.url", conn_url)
.setProperty("hibernate.connection.username", username)
.setProperty("hibernate.connection.password", password)
.setProperty("hibernate.connection.charSet", "utf-8")
.setProperty("hibernate.use_outer_join", "true")
.setProperty("hibernate.c3p0.min_size", "5")
.setProperty("hibernate.c3p0.max_size", "20")
.setProperty("hibernate.c3p0.timeout", "1800")
.setProperty("hibernate.c3p0.max_statements", "50");
return cfg;
}
catch (Exception ex)
{
ex.printStackTrace();
}
return null;
}
----
|