Solved

Ibatis result set

Posted on 2012-04-05
1
566 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jmss example java 2 31
Customizing XML with Powershell 2 31
Need a modeling tool 2 39
XML and version of MS XML Dom Document versions 5 30
This is about my first experience with programming Arduino.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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…

685 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