[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Update a Ozone Object/Transactions



What is the difference between explicit and implicit transaction?. From the
names I could guess that it is by default implicit, where changes are
autocommited.

Following is the code I'm trying, but the change I make(pDoc.createComment)
does get reflected in the database.

What is wrong here?

import org.w3c.dom.Document;

import org.ozoneDB.ExternalTransaction;
import org.ozoneDB.ExternalDatabase;
import org.ozoneDB.RemoteDatabase;

public final class Trans {

    public static void main (String args[]) {

        ExternalDatabase database;
        Document         pDoc;
        String           docName = null;

        System.out.println ("Modify document: " + docName);

        try  {
            database = new RemoteDatabase();
            ((RemoteDatabase)database).open ("localhost", 3333);

            database.reloadClasses ();

            pDoc = (Document) database.objectForName ("test.xml");

            ExternalTransaction tx = database.newTransaction();
            tx.begin();
            pDoc.createComment("This is my COmment"); //Not Working
            tx.commit();
            database.close();
            }
        catch (Exception except) {
            except.printStackTrace ();
            }
        }
    }

Thanks,
-Sarva

-----Original Message-----
From: Falko Braeutigam [mailto:falko@smb-tec.com]
Sent: Friday, September 15, 2000 8:43 AM
To: Saravanan Bellan; 'ozone-users@ozone-db.org'
Subject: Re: Update a Ozone Object


On Fri, 15 Sep 2000, Saravanan Bellan wrote:
> This could be a dumb question, but how do you update a XML document object
> stored in Ozone. I see methods for creating, deleting, copying but no
> update.
> 
> All I want to do is,
> 
> Database Open
> doc = Database , ObjectForName
> Use DOM API to make some changes on doc
> Submit doc.

Well, ozone's DOM is _inherently_ persistent: just commit the transaction
and
all your changes are reflected in the database. This does not just work
for DOM this works for all kind of objects stored in ozone. This is the
architecture of ozone and this makes up its actual power.

Excuse this somewhat emotional answer ;) But it sometimes seemes to me that
this
very basic point of ozone is not well known. Or am I wrong here?


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com