Examples of NextValueRequest


Examples of org.hibernate.ogm.dialect.spi.NextValueRequest

    // given
    IdSourceKeyMetadata keyMetadata = IdSourceKeyMetadata.forTable( "Hibernate_Sequences", "sequence_name", "next_val" );
    IdSourceKey key = IdSourceKey.forTable( keyMetadata, "Foo_Sequence" );

    // when
    Number value = dialect1.nextValue( new NextValueRequest( key, 1, 1 ) );
    assertThat( value ).isEqualTo( 1L );

    // then
    value = dialect2.nextValue( new NextValueRequest( key, 1, 1 ) );
    assertThat( value ).isEqualTo( 2L );
  }
View Full Code Here

Examples of org.hibernate.ogm.dialect.spi.NextValueRequest

      threads[i] = new Thread(
          new Runnable() {
            @Override
            public void run() {
              for ( int i = 0; i < LOOPS; i++ ) {
                dialect.nextValue( new NextValueRequest( test, 1, 1 ) );
              }
            }
          }
      );
      threads[i].start();
    }
    for ( Thread thread : threads ) {
      thread.join();
    }
    Number value = dialect.nextValue( new NextValueRequest( test, 0, 1 ) );
    assertThat( value.intValue(), equalTo( LOOPS * THREADS ) );
  }
View Full Code Here

Examples of org.hibernate.ogm.dialect.spi.NextValueRequest

  }

  @Test
  public void testFirstValueIsInitialValue() {
    final IdSourceKey generatorKey = buildIdGeneratorKey( INITIAL_VALUE_SEQUENCE );
    Number sequenceValue = dialect.nextValue( new NextValueRequest( generatorKey, 1, INITIAL_VALUE_FIRST_VALUE_TEST ) );
    assertThat( sequenceValue ).isEqualTo( INITIAL_VALUE_FIRST_VALUE_TEST );
  }
View Full Code Here

Examples of org.hibernate.ogm.dialect.spi.NextValueRequest

    for ( int i = 0; i < threads.length; i++ ) {
      threads[i] = new Thread( new Runnable() {
        @Override
        public void run() {
          for ( int i = 0; i < LOOPS; i++ ) {
            dialect.nextValue( new NextValueRequest( generatorKey, 1, INITIAL_VALUE_THREAD_SAFETY_TEST ) );
          }
        }
      } );
      threads[i].start();
    }
    for ( Thread thread : threads ) {
      thread.join();
    }
    Number value = dialect.nextValue( new NextValueRequest( generatorKey, 0, 1 ) );
    assertThat( value ).isEqualTo( LOOPS * THREADS );
  }
View Full Code Here

Examples of org.hibernate.ogm.dialect.spi.NextValueRequest

  private IntegralDataTypeHolder doWorkInCurrentTransactionIfAny(SessionImplementor session) {
    IdSourceKey key = getGeneratorKey( session );

    Number nextValue = gridDialect.nextValue(
        new NextValueRequest(
            key,
            optimizer.applyIncrementSizeToSourceValues() ? incrementSize : 1,
            initialValue
        )
    );
View Full Code Here

Examples of org.hibernate.ogm.id.spi.NextValueRequest

  private IntegralDataTypeHolder doWorkInCurrentTransactionIfAny(SessionImplementor session) {
    IdSourceKey key = getGeneratorKey( session );

    Number nextValue = gridDialect.nextValue(
        new NextValueRequest(
            key,
            optimizer.applyIncrementSizeToSourceValues() ? incrementSize : 1,
            initialValue
        )
    );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.