Child pages
  • Errors & Warnings
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Servoy generates both designtime and runtime errors and warnings for things that should receive attention of the developer of the application.

 

Most warnings are self-explanatory, but some require some further explanation. This chapter provides that explanation

Runtime Errors & Warnings

 Update/insert failed, unexpected nr of records affected: expected 1, actual 0

This error indicates that an update or delete of a record failed.

When an update or delete is performed on a record, Servoy checks whether the database reports back that the record was actually updated or deleted. If the database reports that the update or delete did not take place, the Update/insert failed, unexpected nr of records affected: expected 1, actual 0 error is reported.

One scenario that may cause this error is when records are created that do not match the active filters: when a record is deleted or updated in the database the active filter conditions (FoundSet filters and table filters) are added to the generated sql. If the conditions are not met, the update will not happen and Servoy throws this exception. For example, a table filter 'tenant_id = 4' is active and a new customer record is created with null value for the tenant_id. This record can be saved in the database, but a consecutive update or delete will fail (update customers set name = ? where id = ? and tenant_id = 4).

Another scenario that may cause this error to be raised is when data is modified outside Servoy and Servoy is not notified. For example, an orders record is deleted from outside of Servoy while it is loaded in a Servoy Client and that Servoy Client then attempt to delete it. That delete fails with the above error because the database reports that delete from Servoy did not occur, because the record didn't exist.

By default the Servoy Application Server will raise this exception when such scenario occurs. It is possible to suppress these errors by setting the server property servoy.server.throwErrorOnUnexpectedUpdateCount to false. However, this should be used with care and only as a temporary solution until the underlying problem has been discovered and fixed.

 

 

  • No labels