-->
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.  [ 59 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject:
PostPosted: Wed Aug 24, 2005 2:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the datbase location should not affect sessionfactory creation unless you have schemaupdate activated.

And should definitly not affect the classloader performance ...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 5:14 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
"many small" files can be a startup performance problem on some file systems too, try to put stuff to single jar file (it can be faster in some cases). Proxy generation takes a lot of time in my tests, but it can depend on use case too. I see proxy can be 100% lazy generated, Class.newInstance() is synchronized in new JVM implementatios anyway.


Top
 Profile  
 
 Post subject: could it be because you have set
PostPosted: Thu Aug 25, 2005 12:25 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Could it be because you have
<property name="hibernate.hbm2ddl.auto">update</property>
or something like that in the config?
That would definitely make startup with remote DB slower.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: error when using addCacheableFile
PostPosted: Tue Sep 20, 2005 2:47 pm 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
I get the following error when using addCacheableFile on

sessionFactory = cfg.addCacheableFile(CONFIG_FILE_LOCATION).configure().buildSessionFactory();

if I use the standard approach works fine but it takes more than 15 sec to build the session factory.

Any help is appreciated . thank you.

%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: org.dom4j.DocumentException: \com\estudiowebs\hibernate\hibernate.cfg.xml (The system cannot find the path specified) Nested exception: \com\estudiowebs\hibernate\hibernate.cfg.xml (The system cannot find the path specified)
at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:297)
at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:302)
at com.estudiowebs.Hibernate.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:54)
at com.estudiowebs.RafaCentroRCP.Jobs.HibernateInitTask.run(HibernateStartUp.java:72)
Caused by: org.dom4j.DocumentException: \com\estudiowebs\hibernate\hibernate.cfg.xml (The system cannot find the path specified) Nested exception: \com\estudiowebs\hibernate\hibernate.cfg.xml (The system cannot find the path specified)
at org.dom4j.io.SAXReader.read(SAXReader.java:266)
at org.hibernate.cfg.Configuration.addCacheableFile(Configuration.java:281)
... 3 more
java.lang.NullPointerException
at com.estudiowebs.Hibernate.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:64)
at com.estudiowebs.RafaCentroRCP.Jobs.HibernateInitTask.run(HibernateStartUp.java:72)
Input changed to: null


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 3:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
doesnt look like anything to do with addcachablefile. more something to with the loading of your cfg.xml - is it a valid path ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 20, 2005 4:38 pm 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
yes, it is a valid path in fact, if I use the following code it works fine but it takes around 15 secs to startup:

cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 2:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so you *dont* have the exception ? ok.

a call to buildsessionfactory can take that time for large set of classes - how many classes do you have ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 2:30 am 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
I have around 30 mapping files and it is a RCP eclipse desktop application so everytime the user opens it it takes 15 - 20 secs to load hibernate wich is a lot. I wouldn't mine if it was a webapp.

I would like to find an example about how to use the cacheable file or serialize the configuration file.

Thank you in advance

Raul.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 2:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the cfg.xml have never been intended so serialize. It is the hbm.xml files that can be serialized.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 12:27 pm 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
Thanks for clarifying it for some reason I thought that it was done adding the cfg.xml since all the other mapping files were define there.

Since this is a configuration aspect It would make more sense to add an optional attribute in the mapping tag such as cacheable="true" and let hibernate look for a cacheable file instead of having to do it in java.

Thanks for your answer it was helpfull, I will try calling it passing each file individually.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can suggest the cachable attribute in jira - it might be ok

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 1:47 pm 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
Hi Max

I'd like to rate your answer, how do I do that?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 2:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
there should be a rate button (but it only works for the original poster of the topic)

You can read the rules by clicking on the "Whats this" next to the rating.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 3:30 pm 
Beginner
Beginner

Joined: Mon Feb 07, 2005 10:40 pm
Posts: 22
I have posted a temporary solution for improving startup time.
http://forum.hibernate.org/viewtopic.ph ... 68#2262468


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 59 posts ]  Go to page Previous  1, 2, 3, 4

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.