A named counter provides a means of generating monotonically increasing series, such as order or invoice numbers. A counter is identified by its name within an administrative organisation, is created on first use, and is read under a pessimistic write lock so concurrent callers cannot be issued the same value. The stored value is the last number issued, so incrementing returns the next one.
Group: Database Entities
Implements: Serializable
Properties
| Property | Returns | Description |
|---|---|---|
| adminDomain | Organisation | The administrative organisation the counter belongs to, which scopes the counter name so the same name can be used independently by different organisations. |
| counter | long | The last value issued from this counter. A new counter starts at 1, and each increment saves the value that was just handed out. |
| id | long | Database identifier for this counter, assigned when the row is first saved. |
| name | String | Identifier for the series this counter numbers, for example the name of the kind of document being numbered. Unique within the administrative organisation. |
Methods
getId()
Returns: long
Database identifier for this counter, assigned when the row is first saved.
getAdminDomain()
Returns: Organisation
The administrative organisation the counter belongs to, which scopes the counter name so the same name can be used independently by different organisations.
getName()
Returns: String
Identifier for the series this counter numbers, for example the name of the kind of document being numbered. Unique within the administrative organisation.
getCounter()
Returns: long
The last value issued from this counter. A new counter starts at 1, and each increment saves the value that was just handed out.