?
Solved

Ibatis result set

Posted on 2012-04-05
1
Medium Priority
?
588 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 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Six Sigma Control Plans
Starting up a Project

762 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