Package org.hibernate.id.enhanced

Examples of org.hibernate.id.enhanced.SequenceStyleGenerator.configure()


   */
  public void testDefaultedTableBackedConfiguration() {
    Dialect dialect = new TableDialect();
    Properties props = new Properties();
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );

    assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.NoopOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
View Full Code Here


    props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "10" );

    // for dialects which do not support pooled sequences, we default to hilo
    Dialect dialect = new SequenceDialect();
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );

    // for dialects which do support pooled sequences, we default to pooled
View Full Code Here

    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );

    // for dialects which do support pooled sequences, we default to pooled
    dialect = new PooledSequenceDialect();
    generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.PooledOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
View Full Code Here

  public void testDefaultOptimizerBasedOnIncrementBackedByTable() {
    Properties props = new Properties();
    props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "10" );
    Dialect dialect = new TableDialect();
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.PooledOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
View Full Code Here

  public void testForceTableUse() {
    Dialect dialect = new SequenceDialect();
    Properties props = new Properties();
    props.setProperty( SequenceStyleGenerator.FORCE_TBL_PARAM, "true" );
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.NoopOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
View Full Code Here

    // optimizer=none w/ increment > 1 => should honor optimizer
    Properties props = new Properties();
    props.setProperty( SequenceStyleGenerator.OPT_PARAM, OptimizerFactory.NONE );
    props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.NoopOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( 1, generator.getOptimizer().getIncrementSize() );
    assertEquals( 1, generator.getDatabaseStructure().getIncrementSize() );
View Full Code Here

    // optimizer=hilo w/ increment > 1 => hilo
    props = new Properties();
    props.setProperty( SequenceStyleGenerator.OPT_PARAM, OptimizerFactory.HILO );
    props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( 20, generator.getOptimizer().getIncrementSize() );
    assertEquals( 20, generator.getDatabaseStructure().getIncrementSize() );
View Full Code Here

    // optimizer=pooled w/ increment > 1 => hilo
    props = new Properties();
    props.setProperty( SequenceStyleGenerator.OPT_PARAM, OptimizerFactory.POOL );
    props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );
    generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );
    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( 20, generator.getOptimizer().getIncrementSize() );
    assertEquals( 20, generator.getDatabaseStructure().getIncrementSize() );
  }
View Full Code Here

   */
  public void testDefaultedSequenceBackedConfiguration() {
    Dialect dialect = new SequenceDialect();
    Properties props = new Properties();
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );

    assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.NoopOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
View Full Code Here

   */
  public void testDefaultedTableBackedConfiguration() {
    Dialect dialect = new TableDialect();
    Properties props = new Properties();
    SequenceStyleGenerator generator = new SequenceStyleGenerator();
    generator.configure( Hibernate.LONG, props, dialect );

    assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
    assertClassAssignability( OptimizerFactory.NoopOptimizer.class, generator.getOptimizer().getClass() );
    assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
  }
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.