Previous
Previous
 
Next
Next

Stateless Web Applications

Oracle Application Express does not maintain a constant state between the client (that is, the Web browser) and the database, but performs stateless transactions. A database session is only utilized when requesting or submitting a page. Because Oracle Application Express is stateless between the start and the end of a logical transaction, (for example, when updating a record) it is imperative to use optimistic locking rather than pessimistic locking.

Oracle Forms and Microsoft Access use pessimistic locking whereby the record is locked when a user requests a record for update. This lock is maintained until the record is completed (or committed) or canceled (or rolled back). One of the key reasons for not using pessimistic locking within a stateless Web application is that if a user closes their Web browser or looses their connection in the middle of a transaction, the record would remain locked.

Once form pages are generated by the Create Application or Create Page wizards, Automatic Row Fetch and Automatic Row Processing processes are generated which incorporate the MD5 checksum validation to enforce the optimistic locking. Before the record is sent to the database to be updated or deleted the MD5 initially created is compared to the MD5 value of the current database record to ensure they are the same. If they differ then the database record has been updated since it was queried and an error displays to the user.

One consequence of an HTML application is that a rendered page does not perform actions such as validations or hiding and showing fields as the user interacts with the page. Validations are performed when the user submits the page for processing. However, you can change this default behavior by utilizing JavaScript and AJAX. The time needed to load a page is influenced by the transmission speed and the speed with which the Web browser renders the page. Therefore, it is not advisable to attempt to completely replicate the client-side interactivity within a HTML application as the weight (or size) of the page will adversely affect page performance. As a best practice, only implement critical client-side actions.