# When debugging: TableEvent returns false, but record saves

**URL:** <https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683>\
**Category:** Classic Servoy\
**Created:** [February 1, 2008, 6:28pm UTC](https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683 "2008-02-01T18:28:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [February 1, 2008, 6:28pm UTC](https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683/1 "2008-02-01T18:28:02Z")

</div>

Hi all,

In my database I have an integer field called ‘locked’.  
I have attached a method to the onUpdate table event which returns false if locked = 1.

This works fine in Developer except when I switch the debugger on. Then the record saves even if my method returns false…

Anybody else seen this issue?

Developer 3.5.3-build 516  
Java 1.5.0\_13\_119 (Mac OS X)

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [February 4, 2008, 8:01am UTC](https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683/2 "2008-02-04T08:01:33Z")

</div>

Are you using start/commit/rollback transaction?

```auto
databaseManager.startTransaction()

var _ok = databaseManager.saveData()

if (_ok)
     databaseManager.commitTransaction()
else
     databaseManager.rollbackTransaction();

```

I use lot of these situations, and never noticed that my record was saved, unless it didn’t pass by a rollback.

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [February 4, 2008, 11:46am UTC](https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683/3 "2008-02-04T11:46:51Z")

</div>

> martinh:
> 
> ```auto
> databaseManager.startTransaction()
> 
> ```

var \_ok = databaseManager.saveData()

if (\_ok)  
databaseManager.commitTransaction()  
else  
databaseManager.rollbackTransaction();

> ```auto
> 
> ```

Hi Martin,

No, I’m not using transactions yet.

I was going to ask whether Servoy automatically adds a transaction round a databaseManager.saveData() call… What happens if a save sets off a chain of updates through table events and something event method fails or returns false?

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [February 4, 2008, 1:18pm UTC](https://forum.servoy.com/t/when-debugging-tableevent-returns-false-but-record-saves/8683/4 "2008-02-04T13:18:44Z")

</div>

As far as I know, Servoy doesn’t use automatically transactions.

I think as long as you don’t do a saveData(), then you can use databaseManager.rollbackEditedRecords()

But for doing a rollback of updates made in table-events, you must use transactions. It works like that, I’m sure, I’m using the same technology.

If you do that, you will see that with version 3.5.3 that on rollback, you get the same error message ‘your field is locked’ from your table event, but this will be fixed in 3.5.4
