Package io.jmix.data
Interface Sequences
- All Known Implementing Classes:
SequencesImpl
public interface Sequences
Provides access to the database sequences.
-
Method Summary
Modifier and TypeMethodDescriptionlong
createNextValue
(Sequence sequence) Returns the next sequence value.void
deleteSequence
(Sequence sequence) Removes sequence with specified identifierlong
getCurrentValue
(Sequence sequence) Returns the current value of the sequence.void
setCurrentValue
(Sequence sequence, long value) Set current value for the sequence.
-
Method Details
-
createNextValue
Returns the next sequence value. For example:sequences.createNextValue(Sequence.withName("seq_name").setStartValue(10).setIncrement(1))
- Parameters:
sequence
- sequence object- Returns:
- next value
-
getCurrentValue
Returns the current value of the sequence. For some implementationscreateNextValue(Sequence)
must be called at least once beforehand.- Parameters:
sequence
- objectSequence
- Returns:
- current value
-
setCurrentValue
Set current value for the sequence. NextgetCurrentValue(Sequence)
invocation will returnvalue
NextcreateNextValue(Sequence)
invocation will returnvalue + increment
- Parameters:
sequence
- sequence objectSequence
value
- value
-
deleteSequence
Removes sequence with specified identifier- Parameters:
sequence
- sequence objectSequence
- Throws:
IllegalStateException
- if sequence does not exist
-