Examples of JdbcTransaction


Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldInsertNewAuthorUsingSimpleNonPreparedStatements() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      Author author = new Author(99, "someone", "******", "someone@apache.org", null, null);
      MappedStatement insertStatement = ExecutorTestHelper.createInsertAuthorWithIDof99MappedStatement(config);
      MappedStatement selectStatement = ExecutorTestHelper.createSelectAuthorWithIDof99MappedStatement(config);
      int rows = executor.update(insertStatement, null);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldUpdateAuthor() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      Author author = new Author(101, "someone", "******", "someone@apache.org", null, Section.NEWS);
      MappedStatement updateStatement = ExecutorTestHelper.prepareUpdateAuthorMappedStatement(config);
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
      int rows = executor.update(updateStatement, author);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldDeleteAuthor() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      Author author = new Author(101, null, null, null, null, null);
      MappedStatement deleteStatement = ExecutorTestHelper.prepareDeleteAuthorMappedStatement(config);
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
      int rows = executor.update(deleteStatement, author);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldSelectDiscriminatedProduct() throws Exception {
    DataSource ds = createJPetstoreDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
      List<Map> products = executor.query(selectStatement, null, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      connection.rollback();
      assertEquals(16, products.size());
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldSelect10DiscriminatedProducts() throws Exception {
    DataSource ds = createJPetstoreDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedProduct(config);
      List<Map> products = executor.query(selectStatement, null, new RowBounds(4, 10), Executor.NO_RESULT_HANDLER);
      connection.rollback();
      assertEquals(10, products.size());
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldSelectTwoSetsOfAuthorsViaProc() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    connection.setAutoCommit(false);
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectTwoSetsOfAuthorsProc(config);
      List<List> authorSets = executor.query(selectStatement, new HashMap() {
        {
          put("id1", 101);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldSelectAuthorViaOutParams() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    connection.setAutoCommit(false);
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectAuthorViaOutParams(config);
      Author author = new Author(102, null, null, null, null, null);
      executor.query(selectStatement, author, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      connection.rollback();
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldFetchPostsForBlog() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    connection = ConnectionLogger.newInstance(connection);
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPosts);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldFetchOneOrphanedPostWithNoBlog() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPost);
View Full Code Here

Examples of org.apache.ibatis.transaction.jdbc.JdbcTransaction

  @Test
  public void shouldFetchPostWithBlogWithCompositeKey() throws Exception {
    DataSource ds = createBlogDataSource();
    Connection connection = ds.getConnection();
    Executor executor = createExecutor(new JdbcTransaction(connection, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareSelectBlogByIdAndAuthor(config);
      MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostWithBlogByAuthorMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPost);
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.