User bio
404 bio not found
Member since Mar 2, 2016
Posts:
Warlin has not published any posts yet.
Replies:

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. 

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.

Certifications & Credly badges:
Warlin has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Warlin has no followers yet.
Following:
Warlin has not followed anybody yet.