You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Nilesh Bhattad <ni...@outlinesys.com> on 2005/06/14 23:53:50 UTC

Reports using iBatis

Hi,
 
I need to generate some reports using iBatis, JSP/XSLT. For example, one
report should list out all the companies and each company will have the
list of employees associated with that company.
 
CompanyNo.        CompanyName
1                                                                    ABC
Pvt Ltd
EmpNo       EmpName
1                                            Emp1
2                                            Emp2
 
2                                                                    XYZ
Pvt Ltd
EmpNo       EmpName
3                                            Emp3
4                                            Emp4
 
 
Is there a way to write sql statements in iBatis which will produce the
output as List of HashMaps where each hashmap will carry a child list
alongwith current record data..? Once I get the output in this fashion,
I can write JSP/XSLT code accordingly which can print the report in
above format..
 
Would someone please suggest a way of generating this kind of report? I
apologize if a similar question was already asked in this forum.
 
~ Nilesh

Re: Reports using iBatis

Posted by Larry Meadors <la...@gmail.com>.
Sure it is Daniel - there are two ways to do it.

One is with the result map - you can map a result column to another
mapped statement - that is covered in the user guide.

The other (my preference) is to use the groupBy attribute - look on
the wiki for "n+1 selects" for an example of how to do that.

Larry


On 6/15/05, Daniel Henrique Ferreira e Silva <dh...@gmail.com> wrote:
> Hi Nilesh,
> 
> I'm not sure i understood your question, but i'll try to help.
> 
> As far as i got your question, i guess that is not possible right away
> from iBATIS.
> But you can make all sort of things in your DAO layer. Have you wondered that?
> 
> Cheers,
> Daniel Silva.
> 
> On 6/14/05, Nilesh Bhattad <ni...@outlinesys.com> wrote:
> >
> >
> >
> > Hi,
> >
> >
> >
> > I need to generate some reports using iBatis, JSP/XSLT. For example, one
> > report should list out all the companies and each company will have the list
> > of employees associated with that company.
> >
> >
> >
> > CompanyNo.        CompanyName
> >
> > 1
> >          ABC Pvt Ltd
> >
> > EmpNo       EmpName
> >
> > 1                                            Emp1
> >
> > 2                                            Emp2
> >
> >
> >
> > 2
> >          XYZ Pvt Ltd
> >
> > EmpNo       EmpName
> >
> > 3                                            Emp3
> >
> > 4                                            Emp4
> >
> >
> >
> >
> >
> > Is there a way to write sql statements in iBatis which will produce the
> > output as List of HashMaps where each hashmap will carry a child list
> > alongwith current record data..? Once I get the output in this fashion, I
> > can write JSP/XSLT code accordingly which can print the report in above
> > format..
> >
> >
> >
> > Would someone please suggest a way of generating this kind of report? I
> > apologize if a similar question was already asked in this forum…
> >
> >
> >
> > ~ Nilesh
>

Re: Reports using iBatis

Posted by Daniel Henrique Ferreira e Silva <dh...@gmail.com>.
Hi Nilesh,

I'm not sure i understood your question, but i'll try to help.

As far as i got your question, i guess that is not possible right away
from iBATIS.
But you can make all sort of things in your DAO layer. Have you wondered that?

Cheers,
Daniel Silva.

On 6/14/05, Nilesh Bhattad <ni...@outlinesys.com> wrote:
>  
>  
> 
> Hi, 
> 
>   
> 
> I need to generate some reports using iBatis, JSP/XSLT. For example, one
> report should list out all the companies and each company will have the list
> of employees associated with that company. 
> 
>   
> 
> CompanyNo.        CompanyName 
> 
> 1                                                          
>          ABC Pvt Ltd 
> 
> EmpNo       EmpName 
> 
> 1                                            Emp1 
> 
> 2                                            Emp2 
> 
>   
> 
> 2                                                          
>          XYZ Pvt Ltd 
> 
> EmpNo       EmpName 
> 
> 3                                            Emp3 
> 
> 4                                            Emp4 
> 
>   
> 
>   
> 
> Is there a way to write sql statements in iBatis which will produce the
> output as List of HashMaps where each hashmap will carry a child list
> alongwith current record data..? Once I get the output in this fashion, I
> can write JSP/XSLT code accordingly which can print the report in above
> format.. 
> 
>   
> 
> Would someone please suggest a way of generating this kind of report? I
> apologize if a similar question was already asked in this forum… 
> 
>   
> 
> ~ Nilesh