ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diran Ayandele <Adediran.Ayand...@Sun.COM>
Subject Re: Get ResultSet using ibatis
Date Tue, 28 Feb 2006 17:47:36 GMT
Ashish, Maybe I am not understanding your problem, but I don't see why 
you can't map your properties in a result map.  It certainly meets your 
criteria of not changing the sql or java class.  Anyway it looks like this:


    <resultMap id="MyMap" class="your.Class">
        <result property="a" column="first" />
        <result property="b" column="second"/>  
        <result property="c" column="third" />
    </resultMap>

Diran

Ashish Kulkarni wrote:

>Hi
>
>I am still not sure how to use
>http://issues.apache.org/jira/browse/IBATIS-53 for my
>soultion.
>
>This is my real problem and need to find a work around
>I have a SQL statement which returns about 50 values,
>and there a java class with get and set methods, 
>but the data names in SQL statement do not match that
>of java class.
>for example 
>
>my sql statement is as below
>
>SELECT A AS A, B AS B, C AS C FROM MYTABLE
>
>where as my java class is as below with get and set
>methods
>
>public class MyTest
>private String first;
>private String second;
>private String third;
>
>Now i want to Map A to first, B to second and C to
>third.
>
>Unfortunaletly i cannot redefine SQL statement or java
>class as it is too much effort
>
>Any solution to get it working
>(I am trying to modify a old project using ibatis, in
>my previous project we used raw JDBC and prepared
>statements to get resultset)
>
>
>Ashish
>
>
>
>--- Sven Boden <list123@pandora.be> wrote:
>
>  
>
>>Hi Ashish,
>>
>>Have a look at
>>http://issues.apache.org/jira/browse/IBATIS-53 for
>>some 
>>examples of what you can probably use. It's not
>>really the primary use 
>>of iBATIS, but it works ;-)
>>
>>Regards,
>>Sven
>>
>>Ashish Kulkarni wrote:
>>
>>    
>>
>>>Hi
>>>Is it possible to get Resultset as resultClass
>>>      
>>>
>>after
>>    
>>
>>>running a query
>>>Suppose i have a query like below
>>>select * from mytable
>>>how do i define <select...> in xml file so i can
>>>      
>>>
>>get a
>>    
>>
>>>resultset as output from it
>>>I will parse this resultset into objects i need
>>>
>>>Ashish
>>>
>>>__________________________________________________
>>>Do You Yahoo!?
>>>Tired of spam?  Yahoo! Mail has the best spam
>>>      
>>>
>>protection around 
>>    
>>
>>>http://mail.yahoo.com 
>>>
>>>
>>> 
>>>
>>>      
>>>
>>    
>>
>
>
>A$HI$H
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>  
>

Mime
View raw message