Examples of OracleSequenceMaxValueIncrementer


Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

                        newPo.setUsingGeneratedKeysStrategy(false);
                        newPo.setIncrementer(new HsqlMaxValueIncrementer(dataSource, newPo.getBaseName() + "_seq", "value"));
                    }
                    else if ("Oracle".equals(newPo.getDatabaseProductName())) {
                        newPo.setUsingGeneratedKeysStrategy(false);
                        newPo.setIncrementer(new OracleSequenceMaxValueIncrementer(dataSource, newPo.getBaseName() + "_seq"));
                    }
                    else {
                        newPo.setUsingGeneratedKeysStrategy(true);
                    }
                    String metaDataTableName;
View Full Code Here

Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

    dsControl.replay();
    conControl.replay();
    stmtControl.replay();
    rsControl.replay();

    OracleSequenceMaxValueIncrementer incrementer = new OracleSequenceMaxValueIncrementer();
    incrementer.setDataSource(ds);
    incrementer.setIncrementerName("myseq");
    incrementer.setPaddingLength(2);
    incrementer.afterPropertiesSet();

    assertEquals(10, incrementer.nextLongValue());
    assertEquals("12", incrementer.nextStringValue());

    dsControl.verify();
    conControl.verify();
    stmtControl.verify();
    rsControl.verify();
View Full Code Here

Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

  protected void insertWithDB2Sequence(Object entity,String sequenceName,String insertSql) {
    insertWithSequence(entity, new DB2SequenceMaxValueIncrementer(getDataSource(),sequenceName), insertSql);
  }
 
  protected void insertWithOracleSequence(Object entity,String sequenceName,String insertSql) {
    insertWithSequence(entity, new OracleSequenceMaxValueIncrementer(getDataSource(),sequenceName), insertSql);
  }
View Full Code Here

Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

    String pkSequence = cghead.getJformPkSequence();
    if(StringUtil.isNotEmpty(pkType)&&"UUID".equalsIgnoreCase(pkType)){
      pkValue = UUIDGenerator.generate();
    }else if(StringUtil.isNotEmpty(pkType)&&"NATIVE".equalsIgnoreCase(pkType)){
      if(StringUtil.isNotEmpty(dbType)&&"oracle".equalsIgnoreCase(dbType)){
        OracleSequenceMaxValueIncrementer incr = new OracleSequenceMaxValueIncrementer(dataSource, "HIBERNATE_SEQUENCE")
        try{
          pkValue = incr.nextLongValue();
        }catch (Exception e) {
          logger.error(e,e);
        }
      }else if(StringUtil.isNotEmpty(dbType)&&"postgres".equalsIgnoreCase(dbType)){
        PostgreSQLSequenceMaxValueIncrementer incr = new PostgreSQLSequenceMaxValueIncrementer(dataSource, "HIBERNATE_SEQUENCE")
        try{
          pkValue = incr.nextLongValue();
        }catch (Exception e) {
          logger.error(e,e);
        }
      }else{
        pkValue = null;
      }
    }else if(StringUtil.isNotEmpty(pkType)&&"SEQUENCE".equalsIgnoreCase(pkType)){
      if(StringUtil.isNotEmpty(dbType)&&"oracle".equalsIgnoreCase(dbType)){
        OracleSequenceMaxValueIncrementer incr = new OracleSequenceMaxValueIncrementer(dataSource, pkSequence)
        try{
          pkValue = incr.nextLongValue();
        }catch (Exception e) {
          logger.error(e,e);
        }
      }else if(StringUtil.isNotEmpty(dbType)&&"postgres".equalsIgnoreCase(dbType)){
        PostgreSQLSequenceMaxValueIncrementer incr = new PostgreSQLSequenceMaxValueIncrementer(dataSource, pkSequence)
        try{
          pkValue = incr.nextLongValue();
        }catch (Exception e) {
          logger.error(e,e);
        }
      }else{
        pkValue = null;
View Full Code Here

Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

    given(connection.createStatement()).willReturn(statement);
    given(statement.executeQuery("select myseq.nextval from dual")).willReturn(resultSet);
    given(resultSet.next()).willReturn(true);
    given(resultSet.getLong(1)).willReturn(10L, 12L);

    OracleSequenceMaxValueIncrementer incrementer = new OracleSequenceMaxValueIncrementer();
    incrementer.setDataSource(dataSource);
    incrementer.setIncrementerName("myseq");
    incrementer.setPaddingLength(2);
    incrementer.afterPropertiesSet();

    assertEquals(10, incrementer.nextLongValue());
    assertEquals("12", incrementer.nextStringValue());

    verify(resultSet, times(2)).close();
    verify(statement, times(2)).close();
    verify(connection, times(2)).close();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer

    }
    else if (databaseType == MYSQL) {
      return new MySQLMaxValueIncrementer(dataSource, incrementerName, incrementerColumnName);
    }
    else if (databaseType == ORACLE) {
      return new OracleSequenceMaxValueIncrementer(dataSource, incrementerName);
    }
    else if (databaseType == POSTGRES) {
      return new PostgreSQLSequenceMaxValueIncrementer(dataSource, incrementerName);
    }
    else if (databaseType == SQLITE) {
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.