Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence abstraction #365

Open
beikov opened this issue Mar 2, 2017 · 0 comments
Open

Sequence abstraction #365

beikov opened this issue Mar 2, 2017 · 0 comments

Comments

@beikov
Copy link
Member

beikov commented Mar 2, 2017

It is sometimes necessary to have something like a user defined sequence which is more business focused than technical. Since JPA/Hibernate only support sequences through identifiers which is most of the time good enough and offers no API to actually consume sequence values directly, we should step forward and provide an API for that.

I'd like to support transactional and non-transactional sequences i.e. value increments do locking and are only visible after commit or are immediatelly visible. The API should offer support for CRUD operations for sequences and support the following attributes.

  • Sequence name
  • Sequence min and max value
  • Sequence increment value
  • Sequence cache size

In addition to that, further metadata should be providable by the user like e.g. tenant_id. Apart from the metadata itself, it should be possible to get the current value and also get and increment the value i.e. nextval semantics.

The following strategies might be interesting to look at

  • Native sequence - uses a DBMS native sequence and a additional table for metadata
  • Table sequence - uses a table for the sequence value
    • Metadata can be held in a separate table or together with the value
    • Maybe allow a padding for DBMS that do locking?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant