It's possible to map an entity to a counter table, but currently this only works for read and delete operations. For updates, you need to use @Query in order to provide the custom increment/decrement clause:
We could provide something a bit more user-friendly with a new annotation:
(The current counter values in the entity are ignored, it's just used for the primary key – like @Delete)
The API needs a bit more thought:
there can be multiple counter columns
the increment can be different than 1, it can probably be bound as well
do we need a separate annotation for decrementation?
Environment
None
Pull Requests
None
Activity
Show:
Olivier Michallat
July 29, 2020 at 10:11 PM
(edited)
There can be multiple counter columns and they can be updated separately:
Increments can be bound:
Timestamp, TTL and Conditional updates are not supported for counter tables.
Resolution:
We eventually settled on this API:
Initial description:
From this stackoverflow question.
It's possible to map an entity to a counter table, but currently this only works for read and delete operations. For updates, you need to use
@Query
in order to provide the custom increment/decrement clause:We could provide something a bit more user-friendly with a new annotation:
(The current counter values in the entity are ignored, it's just used for the primary key – like
@Delete
)The API needs a bit more thought:
there can be multiple counter columns
the increment can be different than 1, it can probably be bound as well
do we need a separate annotation for decrementation?