Add counter support in the mapper

Description

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?

Environment

None

Pull Requests

None

Activity

Show:
Olivier Michallat
July 26, 2020, 5:23 PM

This also came up on the mailing list.

Olivier Michallat
July 29, 2020, 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.

Fixed

Assignee

Olivier Michallat

Reporter

Olivier Michallat

Labels

None

PM Priority

None

Affects versions

None

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Sprint

Java 4.x

Priority

Minor
Configure