Solved

Ibatis result set

Posted on 2012-04-05
1
580 Views
Last Modified: 2013-11-13
Advance Result Maps.

My question is for the query below how to define a Result Map in MyBatis?

SELECT SUPPLIERS.SUPPLIER_NAME, ORDERS.ORDER_NUMBER FROM SUPPLIERS, ORDERS WHERE SUPPLIERS.SUPPLIER_ID = ORDERS.SUPPLIER_ID

Thanks,
0
Comment
Question by:aniruddhp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
girionis earned 500 total points
ID: 37823108
The simplest would be to have something like the following:

<select id="selectData" resultType="hashmap">
  SELECT SUPPLIERS.SUPPLIER_NAME, ORDERS.ORDER_NUMBER FROM SUPPLIERS, ORDERS WHERE SUPPLIERS.SUPPLIER_ID = ORDERS.SUPPLIER_ID
</select>

Open in new window


because you define an *implicit* resultMap. If you want to define an explicit resultMap you need to have a proper object

package my.pack.age;
public class MyResult {
   String supplier_name;
   int order_number;

    // C'tor and getters/setters
}


<select id="selectData" resultType="my.pack.age.MyResult">
  SELECT SUPPLIERS.SUPPLIER_NAME, ORDERS.ORDER_NUMBER FROM SUPPLIERS, ORDERS WHERE SUPPLIERS.SUPPLIER_ID = ORDERS.SUPPLIER_ID
</select>

Open in new window

0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question