These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Progress bar on initial startup of hibernate
PostPosted: Sat Aug 13, 2005 10:15 am 
Newbie

Joined: Thu Nov 25, 2004 5:56 am
Posts: 7
Location: Slovenia, Europe
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;
}
----


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 13, 2005 11:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
there is not away to get feedback while loading.

why dont you just do something for your app between each call to addresource ?

(but i would think it is buildSessionFactory() that takes the time)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 2:12 am 
Regular
Regular

Joined: Wed Sep 10, 2003 2:26 pm
Posts: 56
Location: San Diego, CA
I think you can kinda hack this by setting hibernate's log level to DEBUG and routing output to a custom logger. This is just a thought, I haven't really done anything like this myself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.