-->
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.  [ 13 posts ] 
Author Message
 Post subject: when will Configuration serialize and why its some field set
PostPosted: Mon Oct 30, 2006 4:42 am 
Beginner
Beginner

Joined: Tue Aug 22, 2006 3:06 am
Posts: 25
when will Configuration serialize and why its some field seted transient?can somebody give your opinion?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 4:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it is serializable. please be more concrete.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 4:54 am 
Beginner
Beginner

Joined: Tue Aug 22, 2006 3:06 am
Posts: 25
I mean why the Configuration is Serializable?which case it will be writed to file stream ?beans?RMI?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 4:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://www.hibernate.org/194.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 5:17 am 
Beginner
Beginner

Joined: Tue Aug 22, 2006 3:06 am
Posts: 25
According that article ,I serialize the whole Configuration but when deserializing it will be error because of the transient field.could you tell
me why the field is setted to transient in a Serializable class?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 6:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
pleae be more concrete...what fields exactly ?

being transient doesnt mean it is not serializable.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: code:
PostPosted: Mon Oct 30, 2006 9:33 pm 
Beginner
Beginner

Joined: Tue Aug 22, 2006 3:06 am
Posts: 25
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();
         }
    }


protected transient Map typeDefs;
the typeDefs will be null after deserializing.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 3:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what exception do you get for that ?

add that exception to this and report it as a bug.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 4:00 am 
Beginner
Beginner

Joined: Tue Aug 22, 2006 3:06 am
Posts: 25
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)

hibernate version:3.1.3
where to report bug?And can u tell me the transient's purpose?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 5:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://hibernate.org/217.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 6:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://hibernate.org/217.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 6:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://hibernate.org/217.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re:
PostPosted: Thu Mar 24, 2011 6:02 am 
Newbie

Joined: Thu Mar 24, 2011 5:59 am
Posts: 1
max wrote:
http://hibernate.org/217.html


Sorry, the page you're looking for cannot be found.

What is a new address of that page?


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