[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Ibatis result set

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
The viewer will learn how to implement Singleton Design Pattern in Java.
Introduction to Processes

656 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