Hi Omer, would your solution consider a trigger? Haven't tried this but you could have a trigger that executes after insert/update that would launch an update on the affected row that basically would "add" the new value in the counter to the old one:
Your queries should change to something like this
INSERT OR UPDATE myTable SET name='Omer', counter = 1
INSERT OR UPDATE myTable SET name='Omer', counter = -1
.....
The logic in the trigger would grab old value (handle NULL as 0) and add the new value only in cases where both are different or whatever your business logic might be.
To prevent infinite loops on updates your after update trigger can be defined to only be executed after any of the other columns in the table are updated with the exception of counter.
The "only" way to do this via SQL would be using stored procedures. You can pass your object tree using either XML or JSON string and process them (using object logic) inside your SP. Standard SQL as intended won't support what you want to achieve.







Annotation concept you describe here is not present in IRIS/Cache. The closest you could get on this would be macros but they don't behave the same as Java Annotations.
As others have mentioned, this is something the language itself (IRIS in this case) would have to provide support for first and then developers can extend by adding their own/custom annotations.