logo       

Re: Explicit transactions: msg#00026

java.enhydra.general

Subject: Re: Explicit transactions

Hi,

Example:

try {
DBTransaction trans = DODS.getDatabaseManager().createTransaction();//
createsne transaction
xxxQuery query= new Query(trans); //creates new Query object inside
transaction
xxxDO aDO = query.nextDO();

....
xxxDO xdo = xxxDO.createExisting (oid, trans); //creates 'existing' Do
object inside transaction
xdo.delete();
....
xxxDO ydo = xxxDO.createVirgin (trans); // creates new DO object insite
transaction
ydo.setYYY(aDO); //set reference - modify DO
yDO.save(trans); //if AutoSave=true, it is done automatically

trans.commit(); //commit all changes in transaction

}catch(Exception ex) {
trans.rollback(); // do rollback if something wrong
}

More information you can find in InsideDODS document (especially about new
parameters (AutoWrite, AutoSave...).

Regards,

Sinisa Milosevic,
Together Serbia


----- Original Message -----
From: "Axel Wilhelm Berle" <axelberle@xxxxxxxx>
To: <enhydra@xxxxxxxxxxx>
Sent: Friday, December 19, 2003 1:52 PM
Subject: Enhydra: Explicit transactions


> Hi!
>
> I have been studying the DODS 5.1 faq (as well as
> Inside DODS and Using DODS) but found no example of
> how to execute multiple tasks in a single transaction.
>
> I would need to perform tasks in the form of:
>
> 1. Start transaction
> 2. Read data
> 3. Delete data
> 4. Create data
> 5. Modify data
> 6. Commit transaction
>
> Could someone send me some examples?
>
>
> Thanks in advance!
>
> Axel
>
>
>
>
>
> =====
> Axel Wilhelm Berle
>
> e-mail: axelberle@xxxxxxxx
> Tel: (office) +55 16 618.0090
> (mobile) +55 16 9964.6343
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de
> _______________________________________________
> Enhydra mailing list
> Enhydra@xxxxxxxxxxx
> http://www.enhydra.org/mailman/listinfo.cgi/enhydra
>


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise