File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes How to access resultmaps from another existing result map in iBATIS 2x Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to access resultmaps from another existing result map in iBATIS 2x" Watch "How to access resultmaps from another existing result map in iBATIS 2x" New topic
Author

How to access resultmaps from another existing result map in iBATIS 2x

Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

Hi ranchers,

I am trying to access an ibatis 2.x result map in another result map in the same sql mapping file. Like this:

But i am getting the following exception when ever i execute my spring-ibatis project:


If i comment out the code that is accessing the other resultmaps from the profileResultMap it works fine. Can somebody please tell me how to refer other result maps from another result map.
Thank you.


Regards,
Deepak

James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

resultMap="profile.rankMap"

Do you need to remove the profile. prefix here? Or even, add it to the other properties using result maps?
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

I tried removing the namespace 'profile' but it didn't do me any good . The exception is still the same
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Why do you need it for one result map and not the others?
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

I need it because i am firing a join query that accesses multiple tables. This result map is the main result map so it is needed for this result map and not the others. My query is as follows:
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

I don't think you answered my question.

Considering where rankMap and branchMap are defined (in the same file as profileMap), I still don't see the need to use resultMap="profile.rankMap" for one and resultMap="branchMap" for the other.
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

Yes you are right. There is no need. I just used it to see if the problem is because i am not using the namespace to access another result map.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Looking at your SQL, how are you expecting

rank.rankName

to map to the result map rankMap? The same applies to branch.
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

What is the problem with the SQL that you are suggesting? I am not able to make out any problem with my sql.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

There is nothing wrong with your SQL. But it looks like you are attempting to map a String to an object.
Deepaks Deshpande
Ranch Hand

Joined: Dec 06, 2007
Posts: 111

Thank you James I realized my mistake the hard way
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

What was the problem in the end?
 
 
subject: How to access resultmaps from another existing result map in iBATIS 2x
 
Similar Threads
Bean creation Exception
IBATIS - multiple parameter
Issue with inserting a BLOB using IBatis DAO
Query from View using iBatis
SqlMap problem in Spring-ibatis integration app