Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are using anything but the most basic of RDBM's then they will handle concurrent updates at the data level. So you're ok there. However you still want to handle the situation of a caller attempting to make an update based off of stale data (which can happen quite often in multi user systems). You can do this in any number of ways:</p> <ul> <li><p>Compute an <a href="http://en.wikipedia.org/wiki/HTTP_ETag" rel="nofollow">ETAG</a> and return it to each caller when they retrieve entity information from the system. For any call to edit/update the caller has to return the save request with the ETAG they were initially given. Then in your system read the persisted entity, compute its ETAG, and make sure its value is equal to what the caller has given. If not equal then you know an edit has been made since the caller retrieve data, and you can raise an error.</p></li> <li><p>If you are using Hibernate you can have this automatically done for you by utilizing its <em>versioning</em> feature. You add a version field to your database, and an annotated version property to your entity. Hibernate will automatically manage entities so annotated, throwing a StaleObjectException if you attempt to update an entity with a version number less than its corresponding row in the database. You can read more about that <a href="http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/entity.html#entity-mapping-entity" rel="nofollow">here</a>.</p></li> </ul> <p>Hope that helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload