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: Caching CGLIB-generated proxies to disk?
PostPosted: Fri Aug 18, 2006 5:33 pm 
Newbie

Joined: Thu Sep 09, 2004 5:09 am
Posts: 7
Our project uses a large number of mappings and mapped classes. It is a client GUI app, so it is started frequently (as opposed to a web server).

Generating the CGLIB proxies alone takes 5-10 seconds. In principle, this is unnecessary because the proxies generated are the same every time. If they were generated to files on disk, they could simply be reloaded at the next run.

I didn't see any option to do anything like this in Hibernate 2 or 3, does anyone know if there is one? Or if there are any plans for such a feature? Or where I might look to try to implement this myself?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 18, 2006 5:45 pm 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Both Configuration and SessionFactory implement Serializable. So you could save SessionFactory it on a file the first time the app is executed.

Every time that the app starts it could look for that file and load a SesionFactory from it and if doesn't exists create a SessionFactory and save it ...

Please, don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 6:51 pm 
Senior
Senior

Joined: Tue Mar 09, 2004 2:38 pm
Posts: 141
Location: Lowell, MA USA
There is an option, you can use instrumented classes. This will do the instrumentation at build time rather than runtime. It also enables some features that are not available when using CGLIB. Have a look here:

http://www.hibernate.org/hib_docs/v3/re ... properties

It's pretty easy to implement and all you need to do is pass all of your persistent classes through the Instrument task. It does make it a bit faster to start up, but it doesn't speed up the parsing of mapping files or annotations.

Serializing a SessionFactory to disk could be problematic as you would have to build in additional logic to look for configuration changes. It also doens't solve the issue your are trying to addres which is to avoid the over head of runtime instrumentation.

Ryan-

_________________
Ryan J. McDonough
http://damnhandy.com

Please remember to rate!


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.