Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » optimistic locking
optimistic locking [message #1386968] Mon, 23 June 2014 10:20 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

In our database every table has a column lastupdate. If multiple users try to update the same record (update tablename set field = xxx where id = nnn and lastupdate = timestamp) only the first one succeeds and the others cannot update the record anymore because a trigger on the table changed the timestamp.

To give a error message to the user that the update did not succed I want to find out that the update changed exactly one record.

Is there a way to find out after an update statement (ISqlService.update) to find out how many records are updated.

Regards Bertin
Re: optimistic locking [message #1386970 is a reply to message #1386968] Mon, 23 June 2014 10:31 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Have been searching for some time but did not see it but it was right for my nose. The returned int of the update statement means the number of records updated.

Regards Bertin

Re: optimistic locking [message #1386971 is a reply to message #1386968] Mon, 23 June 2014 10:32 Go to previous message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
The return value is the number of updated rows, see javadoc.
/**
   * update rows
   * <p>
   * See the interface comment of {@link ISqlService} for description of how to use bind variables
   * </p>
   * 
   * @return number of updated rows
   */
  int update(String s, Object... bindBases) throws ProcessingException;


int changedRowCount=SERVICES.getService(ISqlService.class).update(...);

Previous Topic:Web Service Upload/Download File
Next Topic:Number field with a minValue but no maxValue
Goto Forum:
  


Current Time: Sat Apr 20 00:03:30 GMT 2024

Powered by FUDForum. Page generated in 0.03262 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top