ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakub Scheibe" <jakub.sche...@gmail.com>
Subject Re: Dynamic ResultMaps
Date Tue, 28 Nov 2006 11:53:24 GMT
I need to use this 'exotic' form cause i have a lot of blob field that are
not required all the time. Other thing - i specified ID as ID and it's
working fine! Your my HERO!!! Thanks a lot!!!

Cheers!

On 28/11/06, Prosper <mprospa@yahoo.com> wrote:
>
> Hi, why don't you simply use the where closing in this example?
> If you absolutely want to keep this exotic form, specify
>   ID as ID, assuming that your field name in the db is also ID
>
>
> *Jakub Scheibe <jakub.scheibe@gmail.com>* wrote:
>
> Here is my class
>
>     public class MyClass
>     {
>
>         private string _ID;
>         public string ID
>         {
>             get { return _ID; }
>             set { _ID = value; }
>         }
>
>         private string _Name;
>         public string Name
>         {
>             get { return _Name; }
>             set { _Name = value; }
>         }
>     }
>
> here is my sql
>
>         <select id="Select" parameterclass="MyClass"
> resultclass="MyClass">
>             select
>             <dynamic>
>                 <isEqual property="Id" compareValue="1">
>                     ID
>                 </isEqual>
>                 <isEqual property="Name" compareValue="true" prepend=",">
>                     NAME
>                 </isEqual>
>             </dynamic>
>             from MYTBL
>         </select>
>
> As a result I have only nulls.
> Can u verify what may be wrong?
> May be I'm blind or too something but I don't have any clue what's wrong
> with that ...
>
> Cheers,
> Jakub.
>
>
> On 28/11/06, Nikhil Vaghela <nikhil.vaghela@in.v2solutions.com> wrote:
> >
> >  Make sure that your public property name and the columns which you are
> > retrieving from the query has got same names. Then it definitely works.
> >
> >
> > Nikhil Vaghela
> >
> >   V2Solutions
> >
> > A New Vision to Solutions
> >
> >   India: +91-22-56733201 ext 619
> >
> >   US : 1-408-454-6051  ext 219
> >
> >   http://www.v2solutions.com
> >
> > TZ : +5:30 GMT
> >
> >
> >  ------------------------------
> >  *From:* Jakub Scheibe [mailto:jakub.scheibe@gmail.com]
> > *Sent:* Tuesday, November 28, 2006 4:54 PM
> > *To:* user-cs@ibatis.apache.org
> > *Subject:* Re: Dynamic ResultMaps
> >
> > When I'm using my class as a resultclass i'm only getting
> > null values :(
> >  On 28/11/06, *Nikhil Vaghela* < nikhil.vaghela@in.v2solutions.com>
> > wrote:
> >  Hi ,
> >
> > In such situation you can use resultClass instead of resultMap , and in
> > that case you should have your property [in your custom objects] names same
> > as your query's fields name.
> >
> > Nikhil.
> >  ------------------------------
> >  *From:* Jakub Scheibe [mailto: jakub.scheibe@gmail.com]
> > *Sent:* Tuesday, November 28, 2006 4:42 PM
> > *To:* user-cs@ibatis.apache.org
> > *Subject:* Dynamic ResultMaps
> >
> > Hi,
> >
> > Is there any way to create dynamic resultmaps?
> > In this moment i'm preparing dynamic sql statement but I don't know how
> > to prepare dynamic resultmap
> >
> > Here is how i'm doing this:
> >
> >         <select id="Select" parameterclass="MyClass"
> > resultmap="MyResMap">
> >             select
> >             <dynamic>
> >                 <isEqual property="Id" compareValue="1">
> >                     ID
> >                 </isEqual>
> >                 <isEqual property="Name" compareValue="true"
> > prepend=",">
> >                     NAME
> >                 </isEqual>
> >             </dynamic>
> >             from MYTBL
> >         </select>
> >
> > if I use following resultmap it working ok but i need to use both Id and
> > Name in Select
> >
> >         <resultMap id="MyResMap">
> >                 <result property="Id" column="ID"/>
> >                 <result property="Name" column="Name"/>
> >         </resultMap>
> >
> > Regards,
> > Jakub
> >
> >
>
>
> ------------------------------
> Cheap Talk? Check out<http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>Yahoo!
Messenger's low PC-to-Phone call rates.
>
>

Mime
View raw message