|
Hi,
Could anyone suggest how we can integrate two result-map into one using iBatis. I have two List<Object> coming from two different result-map, both list have a common id based on which merging has to be done i.e object from one list has to be set into another object. Please provide suggestion on this. Thanks, Rhishi |
|
Hi,
Have a look at discriminators, it might do the job. Dridi http://www.zenika.com Le mercredi 18 avril 2012 17:09:13 UTC+2, Rhishi Nema a écrit : Hi, |
|
Sent from my iPhone
|
|
In reply to this post by Dridi Boukelmoune
I want to execute a select statement from within the mapper and than use the corresponding result map to merge with other. I was using association to achieve this and calling select from there but this causes N+1 select problems. In order to avoid this I am using resulmap parameter directly but this is not calling the select statement. Please suggest. Sent from my iPhone
|
|
Hi,
I'm sorry I misread your fist post. I don't know if it's actually possible to do what you want, but here is one thing you can do : class Main { private long id; private String field; private String otherFieldToBeMerged; // getters/setters setMyAssociation(MyAssotiation a) { // maybe check id this.otherFieldToBeMerged = a.getFieldToMerge(); } } class MyAssocation { private long id; private String fieldToMerge; // getters/setters } You can make the MyAssociation class and the setMyAssociation method package private so that it's only visible within the Mapper scope. I might have missed it but I don't know anything in MyBatis that can merge the results of two selects. Dridi http://www.zenika.com/ Le vendredi 20 avril 2012 07:19:31 UTC+2, Rhishi Nema a écrit :
|
| Powered by Nabble | Edit this page |
