This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialization

 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do we need to serialize an object ?
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To store it on the hard disk, or send it through the network mostly.
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need more detais with a scanario and underlying mechanism to understand this concept. If I am sending a query, then it goes through HTML page, at the other end it is received by servlet, servlet transfers the query to database thr JDBC and the result is displayed by JSP. Where does Serialization come in picture in the process ?

Pls explain
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jignesh soni:
Pls explain

Please use real words when posting to the forums. Abbreviations such as "pls" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jignesh soni:
Where does Serialization come in picture in the process ?

It doesn't. In the scenario you described, no object serialization takes place.
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please explain in what scenario, serialization will come in play ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I've never found a need to use serialization directly in my 10 years of Java programming. But I have used technologies that use it under the covers. For example, when using RMI, serialization is used to send data over the network. Or when replicating a servlet session across a cluster, the objects in the session are serialized.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12202
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can write code so that when your process shuts down, it serializes some objects, and saves them to your disk drive. then, a day, a week, a year later, you restart your process. you read the file, and can re-create the objects and have them be in the same state as before you shut down.
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have seen it being used for deep cloning.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50266
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an article somewhere on the Java website about serialization and deep cloning. I think this is it. I have mentioned it before on these boards, and:
  • There is a performance overhead to using serialization like this.
  • There is a subtle difference in the results, but I can't remember what it is. Maybe the article will help. Have a look.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic