Class JPAUIDSequencerImpl

  • All Implemented Interfaces:
    UIDSequencer

    public class JPAUIDSequencerImpl
    extends AbstractUIDSequencer
    This implementation uses a static persistence provider to be able to instantiate this class without passing by Framework.getService -> this is to avoid potential problems do to sequencer factories. Anyway sequencer factories should be removed (I don't think they are really needed).
    Author:
    Bogdan Stefanescu
    • Constructor Detail

      • JPAUIDSequencerImpl

        public JPAUIDSequencerImpl()
    • Method Detail

      • init

        public void init()
        Description copied from interface: UIDSequencer
        Init Sequencer
      • dispose

        public void dispose()
        Must be called when the service is no longer needed
      • getOrCreatePersistenceProvider

        protected PersistenceProvider getOrCreatePersistenceProvider()
      • activatePersistenceProvider

        protected static void activatePersistenceProvider()
      • initSequence

        public void initSequence​(String key,
                                 long id)
        Description copied from interface: UIDSequencer
        Initializes the sequencer with the given key to at least the given long id.

        A sequence can only be incremented, so if its current id is greater than the given id the sequence won't be decremented to reach the given id.

        Specified by:
        initSequence in interface UIDSequencer
        Overrides:
        initSequence in class AbstractUIDSequencer
      • doGetNext

        protected int doGetNext​(String key)
      • getNext

        protected int getNext​(javax.persistence.EntityManager em,
                              String key)