Hi All,
I am trying to speed up my deployment times by serializing my configuration to disk to avoid always needing to parse the mappings on startup.
The following JIRA posts seem to indicate that this should work:
http://opensource.atlassian.com/project ... wse/HB-147 (see Gavin's comment)
http://opensource.atlassian.com/project ... wse/HB-492 (see Max's comment)
However, it seems that the filterDefinitions contained in the Configuration object are not serializable and are causing the following error.
I am using hibernate-3.1.2 but also had a quick peek at hibernate-3.2.alpha2's source and it seems to also have the same problem.
Could this be a regression?
Am I missing something?
Here is the code:
Code:
Configuration cfg = new Configuration().configure("hibernate.cfg.xml");
ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream( filename ) );
oos.writeObject( cfg );
oos.close();
Here's the stack trace:
Code:
java.io.NotSerializableException: org.hibernate.engine.FilterDefinition
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at java.util.HashMap.writeObject(HashMap.java:986)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
Thanks,
Frank 'Grimey' Grimes