public class Neo4jSequenceGenerator extends Object
IdSourceKey.
Both, IdSourceKeyMetadata.IdSourceType.TABLE and IdSourceKeyMetadata.IdSourceType.SEQUENCE are supported. For the table strategy, nodes in
the following form are used (the exact property names and the label value can be configured using the options exposed
by OgmTableGenerator):
(:hibernate_sequences:TABLE_BASED_SEQUENCE { sequence_name = 'ExampleSequence', current_value : 3 })
For the sequence strategy, nodes in the following form are used (the sequence name can be configured using the option
exposed by OgmSequenceGenerator):
(:SEQUENCE { sequence_name = 'ExampleSequence', next_val : 3 })
Sequences are created at startup.
A write lock is acquired on the node every time the sequence needs to be updated.
| Constructor and Description |
|---|
Neo4jSequenceGenerator(org.neo4j.graphdb.GraphDatabaseService neo4jDb,
int sequenceCacheMaxSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
createSequences(Set<PersistentNoSqlIdentifierGenerator> identifierGenerators)
Create the sequence nodes setting the initial value if the node does not exists already.
|
int |
nextValue(IdSourceKey idSourceKey,
int increment)
Generate the next value in a sequence for a given
RowKey. |
public Neo4jSequenceGenerator(org.neo4j.graphdb.GraphDatabaseService neo4jDb,
int sequenceCacheMaxSize)
public void createSequences(Set<PersistentNoSqlIdentifierGenerator> identifierGenerators)
All nodes are created inside the same transaction
identifierGenerators - the generators representing the sequencespublic int nextValue(IdSourceKey idSourceKey, int increment)
RowKey.idSourceKey - identifies the generatorincrement - the difference between to consecutive values in the sequenceCopyright © 2010-2014 Hibernate. All Rights Reserved.