Save and Delete Operations in Transactions

A DO that belongs to a transaction can only be saved into / deleted in its own transaction. Otherwise, DODS throws an exception. Even if the DO is saved /deleted without a transaction parameter, it is saved into / deleted in its own transaction. A DO that belongs to no transaction can be saved into / deleted in an explicit transaction. A DO without a transaction that is saved /deleted without a transaction parameter is saved into / deleted in an implicitly created transaction.

Sample code:

DBTransaction  dbTrans = DODS.getDatabaseManager().createTransaction();
PersonDO person1 = PersonDO.createVirgin(dbTrans);
person1.setFirstname("Person1Name");
person1.setLastname("Person1LastName");
person1.setLogin("p1");
person1.setPassword("p1");
person1.save();