Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any way I can store an object to database in one cell

 
T Zaman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I would like to store an object(such as a list) to a database table in a single cell. What I want to do is store the object in a cell , I want to update the state of the object if I want to later on.Is this possible ? Any idea or suggestion will be highly appreciated . Thanks a lot in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a BLOB and then serialize the object to the field. Updating will then be deserializing, updating, reserializing.
 
Pana Ion
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
imo serialize/deserialize is not a really good idea if the classes of the objects in the lists may change at any point in the future- you will may get an exception when deserializing the older serialized version. This may even be true for different jdk versions. I think "serializing" with a more general format (in a BLOB) - e.g. XML would be better - as you could control backward compatibility. of course, it involves more work.

Of course, what I said is true only if you intend to store objects as data (if you store a class that is a business rule or some sort of handler i guess it is ok).
 
Scott Selikoff
author
Saloon Keeper
Posts: 4014
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but it's probably not a good idea. Figure out the important elements of an object and create columns (or normalized tables) based on those elements. You'll gain the ability to query and run reports on the data once its structured in the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic