المكتبة التقنية ←

Transactions في APEX: افهم حدود الـCommit

English version

A page that displays an error has not necessarily undone every database change made along the way. Transaction boundaries deserve explicit attention in APEX.

Read the documented commit points

Oracle documents implicit commits after rendering, before branching on submit, and before redisplaying a page following validation failure. Computations and certain session-state changes can also introduce commits. This is why “validation failed, so everything rolled back” is unsafe reasoning. Oracle's processing guide.

For a business operation, validate inputs before changing business rows. Keep related changes together in a package operation, inspect called routines for commits, and avoid unnecessary session-state assignments between dependent changes. An explicit commit makes earlier work permanent; a later exception cannot reverse it.

A wizard spans requests

A five-step wizard is not one database transaction stretched across five pages. Store incomplete input as draft state, for example in an appropriately designed collection or draft model. Validate again when finalizing, and define cancellation as a business action against that draft state.

Leaving a browser page does not issue a universal rollback. It also cannot undo changes committed by earlier requests.

Editorial correction: the original post incorrectly promised blanket rollback on validation failure or cancellation, and a single automatic commit for every wizard.

Before adopting a design, test failure paths and commit boundaries in an isolated development environment. This article explains the documented behavior; it does not report a database test.

النسخة العربية

ظهور رسالة خطأ في الصفحة لا يعني بالضرورة إن كل تغيير حصل في قاعدة البيانات اتلغى. حدود الـTransaction في APEX محتاجة فهم واضح.

راجع نقاط الـCommit الموثقة

Oracle بتوثق Implicit Commit بعد عرض الصفحة، وقبل الانتقال لصفحة تانية بعد Submit، وقبل إعادة عرض الصفحة عند فشل Validation. كذلك Computations وبعض تغييرات Session State ممكن تدخل نقاط Commit. لذلك جملة «الـValidation فشلت، إذن كل حاجة اتعمل لها Rollback» استنتاج غير آمن. دليل معالجة الصفحات من Oracle.

في العملية التجارية، راجع المدخلات قبل تغيير سجلات العمل. اجمع التغييرات المرتبطة داخل عملية في Package، وراجع أي Commit في الإجراءات المستدعاة، وتجنب تغيير Session State بدون داعٍ بين تغييرات تعتمد على بعضها. الـCommit الصريح يجعل العمل السابق دائمًا؛ Exception بعدها لا تقدر ترجعه.

الـWizard عبارة عن طلبات متعددة

Wizard من خمس خطوات مش Transaction واحدة ممتدة بين خمس صفحات. احفظ المدخلات غير المكتملة كمسودة، مثل Collection أو نموذج Draft مصمم للغرض. أعد التحقق عند الحفظ النهائي، وحدد معنى الإلغاء كإجراء يتعامل مع المسودة.

الخروج من المتصفح لا ينفذ Rollback شامل، ولا يلغي تغييرات اتعمل لها Commit في طلبات سابقة.

تصحيح تحريري: البوست الأصلي وعد خطأً بـRollback شامل عند فشل Validation أو الإلغاء، وبـCommit تلقائي واحد لكل Wizard.

قبل اعتماد التصميم، اختبر مسارات الفشل وحدود الحفظ في بيئة تطوير معزولة. المقال يشرح السلوك الموثق، ولا يدّعي تنفيذ اختبار على قاعدة بيانات.