Examples of queryForLong()


Examples of org.springframework.jdbc.core.JdbcTemplate.queryForLong()

        }

        // Since the service task after the user tasks throws an exception, both
        // the record and the process must be rolled back !
        assertEquals("My Task", taskService.createTaskQuery().singleResult().getName());
        assertEquals(0, jdbcTemplate.queryForLong("select count(*) from MY_TABLE"));

        // Cleanup
        jdbcTemplate.execute("drop table MY_TABLE if exists;");
    }

View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForLong()

   * @param nextVal Value that should be yielded by next NEXVAL call
   */
  public void oracleSequenceSetNextVal(String sequenceName, long nextVal) {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
   
    Long currentValue = jdbcTemplate.queryForLong(String.format("SELECT %s.NEXTVAL from dual", sequenceName));
    Long increment = nextVal - currentValue - 1;
    jdbcTemplate.execute(String.format("ALTER SEQUENCE %s INCREMENT BY %d", sequenceName, increment));
    jdbcTemplate.execute(String.format("SELECT %s.NEXTVAL from dual", sequenceName));
    jdbcTemplate.execute(String.format("ALTER SEQUENCE %s INCREMENT BY 1", sequenceName));
  }
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForLong()

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.execute("create table MY_TABLE (MY_TEXT varchar);");
   
    // The hello() method will start the process. The process will wait in a user task
    userBean.hello();
    assertEquals(0, jdbcTemplate.queryForLong("select count(*) from MY_TABLE"));
   
    // The completeTask() method will write a record to the 'MY_TABLE' table and complete the user task
    try {
      userBean.completeTask(taskService.createTaskQuery().singleResult().getId());
      fail();
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForLong()

    } catch (Exception e) { }
   
    // Since the service task after the user tasks throws an exception, both
    // the record and the process must be rolled back !
    assertEquals("My Task", taskService.createTaskQuery().singleResult().getName());
    assertEquals(0, jdbcTemplate.queryForLong("select count(*) from MY_TABLE"));
   
    // Cleanup
    jdbcTemplate.execute("drop table MY_TABLE if exists;");
  }
 
View Full Code Here

Examples of org.springframework.jdbc.core.JdbcTemplate.queryForLong()

  @FlywayTest(invokeCleanDB=true,locationsForMigrate={"db/test"})
  public void testOne()
  {
    System.out.println("ServiceTest.testOne()");
    JdbcTemplate template  = new JdbcTemplate(ds);
    long count = template.queryForLong("SELECT count(*) from demo5.user_accounts");
    Assert.assertEquals(1, count);
  }
 
  @Test
  @FlywayTest(invokeCleanDB=true,locationsForMigrate={"db/test"})
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.