-->
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.  [ 8 posts ] 
Author Message
 Post subject: Serialize SessionFactory or Metadata?
PostPosted: Wed Apr 27, 2016 2:46 pm 
Newbie

Joined: Wed Apr 27, 2016 2:45 pm
Posts: 6
I would like to speed up startup time by serializing the Metadata and/or SessionFactory. I'm willing to mess with the code a bit to add Serializable, how realistic is this?


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Thu Apr 28, 2016 1:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
It's not very realistic. The SF might use a connection pool (e.g. C3P0, HikariCP), in which case those will not be serialized properly. Probably it's not an impossible task, but it's very tricky to make sure that all Hibernate Services are properly initialized after deserialization.


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Fri Apr 29, 2016 9:02 am 
Newbie

Joined: Wed Apr 27, 2016 2:45 pm
Posts: 6
just serializing the metadata would avoid the connection pool problems right? I've been trying that and made some of the class loader related stuff, ClassLoaderDelegate, ClassLoaderService transient as it can be instantiated without deserialalization. also the JavaReflectionManager, but still getting unserializable exception on JavaXProperty, not sure what is trying to serialize it if the reflection manager is transient. I did t want to mess with hibernate Commons annotation


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Wed May 04, 2016 11:33 am 
Newbie

Joined: Wed Apr 27, 2016 2:45 pm
Posts: 6
I managed to get it serializing and deserializing.. but you were dead on. it cannot find services in the registry even though they are there. any ideas?


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Thu May 05, 2016 4:33 pm 
Newbie

Joined: Wed Apr 27, 2016 2:45 pm
Posts: 6
I successfully got it working. Took some effort but i does serialize using a custom SessionFactoryBuilderFactory. I can do a PR if you guys are interested. Might needs a bit of cleaning up but in general it seems solid.


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Mon May 30, 2016 7:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Sure. You can send the PR, thanks.


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Fri Jun 03, 2016 8:39 pm 
Newbie

Joined: Wed Apr 27, 2016 2:45 pm
Posts: 6
I posted a PR. I have filled out the CLA in the past for JBoss Rules. I tried making a JIRA account and logging in but failed..


Top
 Profile  
 
 Post subject: Re: Serialize SessionFactory or Metadata?
PostPosted: Sat Jun 04, 2016 1:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Thanks, we will review it soon.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.