• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Version Control in Java

 
Niyas Ahmed Sheikh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • 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 ]
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic