[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2204) transient field make Configuration deserializing error
Yajun Shi (JIRA)
noreply at atlassian.com
Wed Nov 15 13:44:06 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2204?page=comments#action_25309 ]
Yajun Shi commented on HHH-2204:
--------------------------------
I don't think transient object can be serialized.
> transient field make Configuration deserializing error
> -------------------------------------------------------
>
> Key: HHH-2204
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2204
> Project: Hibernate3
> Type: Bug
> Components: build
> Versions: 3.1.3
> Environment: hibernate 3.1.3
> database: HSQLDB
> Reporter: ronald feng
>
> Original Estimate: 3 days
> Remaining: 3 days
>
> [code]
> Configuration configuration=null;
> try {
> Configuration configurationSerializable = new Configuration();
> FileOutputStream fos = new FileOutputStream("serial");
> ObjectOutputStream oos = new ObjectOutputStream(fos);
> oos.writeObject(configurationSerializable);
> oos.flush();
> oos.close();
> } catch (FileNotFoundException e) {
> e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
> }
> catch (IOException e) {
> e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
> }
> try {
> FileInputStream fis = new FileInputStream("serial");
> ObjectInputStream ois = new ObjectInputStream(fis);
> configuration = (Configuration) ois.readObject();
> ois.close();
> } catch (FileNotFoundException e) {
> e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
> }
> catch (IOException e) {
> e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
> }
> catch (ClassNotFoundException e) {
> e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
> }
> if(configuration!=null)
> {
> SessionFactory sessionFactory = configuration.configure().buildSessionFactory();
> }
> }
> [/code]
> protected transient Map typeDefs;
> the typeDefs will be null after deserializing.
> [code]Exception in thread "main" java.lang.NullPointerException
> at org.hibernate.cfg.Mappings.getTypeDef(Mappings.java:376)
> at org.hibernate.cfg.HbmBinder.bindSimpleValueType(HbmBinder.java:1161)
> at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1129)
> at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:400)
> at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:343)
> at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
> at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
> at org.hibernate.cfg.Configuration.add(Configuration.java:386)
> at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
> at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
> at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
> at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
> at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
> at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
> at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
> at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
> at org.rzeus.hibernate.test.TestSerializeAndTransient.main(TestSerializeAndTransient.java:50)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)[/code]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list