My event handler cannot prevent data insertion

Hello,
I have uploaded an event handler, to implement the beforeCreate method.
it was uploaded successfully, but I think it is not called.
i am throwing an exception in the case where my check returned false, and I don’t want the insertion to happen,
yet the insertion still happens.
I assumed that I can prevent the insertion this way. is this correct?
also, can I modify the values of the inserted data?

Starting CodeRunner
Listening for transport dt_socket at address: 5005
[INFO] JDK from “JAVA_HOME” - C:\Program Files\Java\jdk1.8.0_73
[INFO] JRE from “JRE_HOME” - C:\Program Files\Java\jre1.8.0_73
[INFO] CodeRunner™ Backendless Debugging Utility
[INFO] Copyright© 2016 Backendless Corp. All rights reserved.
[INFO] Version: 3.0.12 Build date: 20160321-1136
[INFO] CodeRunner session is running for 2 hour and will be terminated on 17:39:41.602[UTC]
[INFO] Registering runner on: ‘http://api.backendless.com’ with version ‘v1’
[INFO] Application ID: ‘false Id…’
[INFO] Secret key: ‘false key…’
[INFO] Runner successfully registered
[INFO] Parsing event model…
[INFO] Build successfully: 2 handlers, 0 timers
[INFO] Deploying model to server, and starting debug…
[INFO] Model successfully deployed.
[INFO] Waiting for events…
[INFO] Publishing 2 event handlers and 0 timers and 0 services to the serverΓאª
[INFO] Successfully published all event handlers and timers.
[INFO] If you connected to coderunner for debug - please stop debugging
[INFO] CodeRunner will shutdown now
[INFO] Debugging Utility disconnected successfully
[INFO] Thank you for using Backendless

Does CodeRunner sit and wait for requests? Or the following output shows up right away and CodeRunner quits?

[INFO] If you connected to coderunner for debug - please stop debugging
[INFO] CodeRunner will shutdown now
[INFO] Debugging Utility disconnected successfully
[INFO] Thank you for using Backendless

Now I ran CodeRunner.bat without debug. It waits for events but doesn’t print any of the System.out.println (Which was printed when I used Rest api before).

Starting CodeRunner
Listening for transport dt_socket at address: 5005
[INFO] JDK from “JAVA_HOME” - C:\Program Files\Java\jdk1.8.0_73
[INFO] JRE from “JRE_HOME” - C:\Program Files\Java\jre1.8.0_73
[INFO] CodeRunner™ Backendless Debugging Utility
[INFO] Copyright© 2016 Backendless Corp. All rights reserved.
[INFO] Version: 3.0.12 Build date: 20160321-1136
[INFO] CodeRunner session is running for 2 hour and will be terminated on 12:09:
34.790[UTC]

[INFO] Registering runner on: ‘http://api.backendless.com’ with version ‘v1’
[INFO] Application ID: ‘AF8A6FD1-7119-6D55-FF83-BC9AA0072B00’
[INFO] Secret key: ‘B69BCDE1-A01C-5BCC-FFFA-1EB8F0B83800’
[INFO] Runner successfully registered
[INFO] Parsing event model…
[INFO] Build successfully: 2 handlers, 0 timers
[INFO] Deploying model to server, and starting debug…
[INFO] Model successfully deployed.
[INFO] Waiting for events…

Any response please?

I implemented beforeCreate() in my event handler, but my code doesn’t seem to be running

Do you see the handler on the Debug tab of “Business logic” page?

Also note that handler wouldn’t be invoked when creating object through console.

Yes it is in the debug section (see attached print screen)
and I am creating my object through my android app code. the row is created, but the event handler is not called.
I know it because it is not printing the System.out.println, nor doing an insert i am doing there for testing:
Map testMap = new HashMap();
testMap.put(“testColumn”, “event handler was called”);
Backendless.Data.of(“TestTable”).save(testMap);

Can you send your business logic project to support@backendless.com with link to this topic?

Yes, I sent the email

Ok, I’ve got and tried it, but it worked for me.
I’m getting an exception while invoking, but it’s an expected exception.
Can you try to debug your custom code as described here: https://backendless.com/documentation/business-logic/java/bl_debugging.htm
Just put a breakpoint at the beginning of “beforeCreate” handler and try to invoke it, for example, from REST console.

Great. now I could enter debug mode, and also see what was wrong.

it works now, both in debug mode and when I deploy.
Thank you Alexander for your support and going over my project!