Life Cycle of an Entity Object.

Tuesday, April 08, 2008

When a new row is created on entity-based view object, the entity status is set as New. Transaction's list of pending changes is updated with the new row. When the transaction is committed, the row will be saved to the data base. But when a blank row is created, the user may not have entered any data. So by setting the row status to 'initialized', the new row can be forced to remove from the Transaction's list of pending changes. This prevents the system from posting the row into database, if the user never enters any data into any attribute of that initialized row. When the user enters data into any attribute of the initialized row, the row status changed to New.













When an entity is retrieved from the database, its status is set as Unmodified. When the user enters data into any attribute of the unmodified row, the row status changed to Modified. When user calls remove() on Unmodified row, the row status changes to Deleted. If the row is in New state and the user calls remove() on the row, row status changes to Dead.

When an entity is retrieved from database, the entity is assumed to be valid. When any attribute of the entity is modified or a new entity row is created, the entity is marked as invalid. Before committing the transaction, system validates all invalid entity rows in the Transaction's pending list. Then the changes are posted to database and the row status changes to Unmodified.

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP