Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between serialization and database storage

What is difference between serialization and database storage In java? Doesnt serialization actually mean storing data in a database on server?

like image 488
Purvesh Avatar asked Dec 07 '22 12:12

Purvesh


1 Answers

Let's think of the database like a bowl.

enter image description here

If you want to keep stuff from going everywhere, you put it in the bowl.

Your stuff is the data you want to store. Right now it's out there, on the table, in a box. enter image description here

So we're going to take the stuff out of that box. The problem is, the stuff in our box probably won't fit into the bowl. How do we fix that?

We need to change it into the type of object that will fit into our bowl. We need to serialize it.

enter image description here

Our serialized data will fit in the bowl now. So we take our serialized data and we pour it into the bowl, and we have the most important meal of the day.

enter image description here

In case this was all really complicated. Simplified: to serialize is to change, and a database is a place to store stuff. Often, you change stuff before you store it.

like image 189
deltree Avatar answered Dec 09 '22 01:12

deltree