ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Boden <list...@pandora.be>
Subject Re: Get ResultSet using ibatis
Date Tue, 28 Feb 2006 17:44:10 GMT
For your problem forget the IBATIS-53 examples... How about something as:

  <resultMap id="some-result-map" class="MyTest">
    <result property="first" column="A"/>
    <result property="second" column="B"/>
    <result property="third" column="C"/>
  </resultMap>

as resultmap.... mapping from sql to properties.

Regards,
Sven

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