Serious Isue: Database Transaction on Openbiz

28 views
Skip to first unread message

Agus Suhartono

unread,
Jul 10, 2013, 1:37:01 AM7/10/13
to openbiz-cubi
Hi all,

I found that database transaction on openbiz is DataObject by
DataObject, so if we work on multiple table or DataObject, database
transaction maybe not work correctly

for example, if save master detail in sale transaction, if occur error
at transaction item, then all save record on transaction item must
rollback.

i think this is serious isue, because Openbiz is Business Application framework,
which database integrity is high priority


reference :
http://www.zendframeworkinaction.com/2010/03/05/steve-hollis-blog-practical-nested-transactions-with-zend_db-and-mysql/

http://blog.ekini.net/2010/03/05/zend-framework-how-to-use-nested-transactions-with-zend_db-and-mysql/

both ref have link to
http://www.stevehollis.com/2010/03/practical-nested-transactions-with-zend_db-and-mysql/
but broken.

Agus Suhartono

Rocky Swen

unread,
Jul 10, 2013, 7:51:50 PM7/10/13
to openbi...@googlegroups.com

This is a good question. I met the same issue in other projects. As a workaround, we use BizSystem::get DBConnection to get Zend_Db_Adapter instance, then call its begibTransaction method and the rest.

What is your suggestion on transaction? Should we make the transaction an optional attribute in DO xml?

--
You received this message because you are subscribed to the Google Groups "Openbiz Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openbiz-cubi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Agus Suhartono

unread,
Jul 21, 2013, 2:52:22 AM7/21/13
to openbiz-cubi
Goal of using transaction is : when we updating multiple record, and
one of record error then all record can rollback.

I found BizDataObj use transaction in single record updating
(BizDataObj::updateRecord() ).

I'm not sure, what's happen when this code execute and error:

$db = BizSystem::get DBConnection();
$db->beginTransaction();

try
{
$saleDO->updateRecord($saleMaster);
foreach ($saleItemList as $saleItem) {
$saleItemDO->updateRecord($saleItem);
}
$db->commit();
}
catch (Exception $e)
{
$db->rollBack();
}


Best Regards

Agus Suhartono

Rocky Swen

unread,
Jul 23, 2013, 12:18:40 AM7/23/13
to openbi...@googlegroups.com
I think a quick solution is to add a public method in BizDataObj that allows the caller force the DO to skip transaction. For example,
public function setUseTransaction($flag) { $this->useTransaction = $flag; }
Then all DO transaction related code, don't use transaction call if the flag is false;

Rocky



Agus Suhartono

Reply all
Reply to author
Forward
0 new messages