Hi Alberto, please try to replace this
OSequenceLibrary sequenceLibrary = access.graph.getRawGraph().getMetadata(). getSequenceLibrary(); with this OMetadata md = access.graph.getRawGraph().getMetadata(); md.reload(); OSequenceLibrary sequenceLibrary = md.getSequenceLibrary(); Maybe it's just a matter of caching Thanks Luigi 2017-01-26 0:07 GMT+01:00 Maverick <[email protected]>: > Each time this code is executed, a new sequence is created with the same > name, and so the method always returns 1 as next number. Why? > > > public long next( String seqName ) { > > OSequenceLibrary sequenceLibrary = access.graph.getRawGraph(). > getMetadata().getSequenceLibrary(); > > OSequence seq = sequenceLibrary.getSequence( seqName ); > > if( seq == null ) { > > seq = sequenceLibrary.createSequence(seqName, SEQUENCE_TYPE.ORDERED, new > OSequence.CreateParams().setStart(0L)); > > } > > return seq.next(); > > } > > > I'm using graphdb v.2.2.13 > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
