Package org.apache.ibatis.mapping

Examples of org.apache.ibatis.mapping.MappedStatement


  @Test
  public void shouldSelectDiscriminatedPost() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedPost(config);
      List<Map<String,String>> products = executor.query(selectStatement, null, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      assertEquals(5, products.size());
      for (Map<String,String> m : products) {
        if ("IMAGES".equals(m.get("SECTION"))) {
          assertNull(m.get("subject"));
View Full Code Here


  @Test
  public void shouldSelect2DiscriminatedPosts() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectDiscriminatedPost(config);
      List<Map<String,String>> products = executor.query(selectStatement, null, new RowBounds(2, 2), Executor.NO_RESULT_HANDLER);
      assertEquals(2, products.size());
      for (Map<String,String> m : products) {
        if ("IMAGES".equals(m.get("SECTION"))) {
          assertNull(m.get("subject"));
View Full Code Here

  @Test
  public void shouldSelectTwoSetsOfAuthorsViaProc() throws Exception {
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectTwoSetsOfAuthorsProc(config);
      List<List<Author>> authorSets = executor.query(selectStatement, new HashMap<String, Object>() {
        {
          put("id1", 101);
          put("id2", 102);
        }
View Full Code Here

  @Test
  public void shouldSelectAuthorViaOutParams() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, 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);
      assertEquals("sally", author.getUsername());
      assertEquals("********", author.getPassword());
      assertEquals("sally@ibatis.apache.org", author.getEmail());
View Full Code Here

  @Test
  public void shouldFetchPostsForBlog() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPosts);
      List<Post> posts = executor.query(selectPosts, 1, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      assertEquals(2, posts.size());
View Full Code Here

  @Test
  public void shouldFetchOneOrphanedPostWithNoBlog() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPost);
      List<Post> posts = executor.query(selectPost, 5, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      executor.rollback(true);
View Full Code Here

  @Test
  public void shouldFetchPostWithBlogWithCompositeKey() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareSelectBlogByIdAndAuthor(config);
      MappedStatement selectPost = ExecutorTestHelper.prepareSelectPostWithBlogByAuthorMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPost);
      List<Post> posts = executor.query(selectPost, 2, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      assertEquals(1, posts.size());
View Full Code Here

  @Test
  public void shouldFetchComplexBlogs() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPosts);
      List<Blog> blogs = executor.query(selectBlog, 1, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      assertEquals(1, blogs.size());
View Full Code Here

  @Test
  public void shouldMapConstructorResults() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatementWithConstructorResults(config);
      List<Author> authors = executor.query(selectStatement, 102, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
      executor.flushStatements();
      executor.rollback(true);
      assertEquals(1, authors.size());
View Full Code Here

  @Test
  public void shouldClearDeferredLoads() throws Exception {
   
    Executor executor = createExecutor(new JdbcTransaction(ds, null, false));
    try {
      MappedStatement selectBlog = ExecutorTestHelper.prepareComplexSelectBlogMappedStatement(config);
      MappedStatement selectPosts = ExecutorTestHelper.prepareSelectPostsForBlogMappedStatement(config);
      config.addMappedStatement(selectBlog);
      config.addMappedStatement(selectPosts);
      MappedStatement selectAuthor = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
      MappedStatement insertAuthor = ExecutorTestHelper.prepareInsertAuthorMappedStatement(config);

      //generate DeferredLoads
      executor.query(selectPosts, 1, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);

      Author author = new Author(-1, "someone", "******", "someone@apache.org", null, Section.NEWS);
View Full Code Here

TOP

Related Classes of org.apache.ibatis.mapping.MappedStatement

Copyright © 2018 www.massapicom. 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.