aspose file tools*
The moose likes Java in General and the fly likes Version Control in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Version Control in Java" Watch "Version Control in Java" New topic
Author

Version Control in Java

Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
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

Joined: Oct 29, 2001
Posts: 8910
    
    8

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
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

Joined: Oct 29, 2001
Posts: 8910
    
    8


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

Joined: Jun 15, 2005
Posts: 129
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Version Control in Java