• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Version Control in Java

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How to serialize the object(notepad,word...) to the database in Java?

For example: I am having a notepad "a1.txt". It has some content and I am serializing the object(notepad's content) in the databse. (now a1.txt - version 1.0)

After some time, I am once again opening the notepad and doing some modification and saving that file and serializing it again in the databse. (now version 2.0)

After some time I want to revert back the version 2.0 to version 1.0, due to some reason.
How can we achieve this in java? Any direction, idea or sample coding will be helpful.

I know it's purely my exercise, but don't know where and how to start. Hope this group will help me.

I am also doing my homework in it. I know how to serialize the object in the file, but not in the database. Any sample coding or sample open source software related to this will be useful
[ September 12, 2005: Message edited by: Niyas Ahmed Sheikh ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I know how to serialize the object in the file, but not in the database.


One of the great advantages of using an object-oriented language is that once you learn to serialize to one thing (a file), you can serialize to everything (a socket, a pipe, a database). There's a couple of classes that let you open an InputStream to a database field, java.sql.PreparedStatement and java.sql.Blob/Clob to name a few. You have to declare your table to have a column of the correct type and size.
 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply Joe.
If you have some sample codings/site regarding this will be useful.
Okay, we are serializing the object to the databse. Whether for the version control, what are the other thing we have to take care.
For example:

[ September 12, 2005: Message edited by: Niyas Ahmed Sheikh ]
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


If you have some sample codings/site regarding this will be useful.


The
Java Tutorial covers JDBC from The Basics to using datatypes like BLOB/CLOB.
If this were my assignment, I'd start by seperating the big problem into smaller problems (the Most Basic Programming Skill). Try to serialize a file to a database and then recover it. After you can successfully do that, worry about how to store versions of documents and recover particular ones.
 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay Joe, as per your advice I am going to split the big ones to smaller ones.
First, I am going to try out serializing the object to the database and retrieving it from the database. Then I will come to you
 
This is my favorite tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic