• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deepaks Deshpande
Ranch Hand
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried removing the namespace 'profile' but it didn't do me any good . The exception is still the same
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need it for one result map and not the others?
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you James I realized my mistake the hard way
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the problem in the end?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic