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 jeremy jardin <je...@newtec.caisse-epargne.fr> on 2006/07/10 15:41:08 UTC

RE : selectByExample

Ok thx !!
 
So, by the way, is it possible to set that indicator using one method ?
Something like 'criteria.setMobile ("xxxxx", "UtilisateurExample.EXAMPLE_EQUALS) ' ??
 
 
 
-----Message d'origine-----
De : Jeff Butler [mailto:jeffgbutler@gmail.com] 
Envoyé : lundi 10 juillet 2006 15:33
À : user-java@ibatis.apache.org
Objet : Re: selectByExample
 
With the current version of Abator you do need to specify how the criterion will be applied.  So your code should look like this:
 
UtilisateurExample criteria = new UtilisateurExample() ;
criteria.setMobile ("0600000000"),
criteria.setMobile_Indicator(UtilisateurExample.EXAMPLE_EQUALS );

Jeff Butler

 
On 7/10/06, jeremy jardin <je...@newtec.caisse-epargne.fr> wrote: 
Hi,
 
 
I'm trying to use Ibatis in my application.
I've also used Abator plugin to generate my javabeans and xml files.
 
Today, I'm writing a bean Manager, used to store/delete/update datas in database.
I want to write methods able to give list according to the beanExample.
 
When I look in debug Mode how it works, I don"t understand.
My junit test file just try to get a user from his phone number, and request answers the whole user list of my database. 
 
I proceed like that :
        
        UtilisateurExample criteria = new UtilisateurExample( ) ;
        Criteria.setMobile ("0600000000"),
 
        ArrayList userList = new ArrayList() ;
                
        UtilisateurDAOImpl userDao = new UtilisateurDAOImpl () ;
                
        userDao.setSqlMapClient(sqlMap);
        
        try 
        {
            list = (ArrayList)userDao.selectByExample(criteria); 
        }
        catch (SQLException e)
        {}
 
that code give me the whole user list (that' s not true, no one user in my database has that phonenumber)
But if I precise :
 
            Criteria.setMobileIndicator(1) ;
 
It works well  !!
 
I don't understand why should I set explicitly that mobileIndicator ???
Am using ibatis the good way ??
 
Thx !! 
 
                        
 

Re: RE : selectByExample

Posted by Jeff Butler <je...@gmail.com>.
No, it takes two methods calls.  The next version of Abator will generate
much more intuitive and functional example methods.  I'll release it as soon
as iBATIS 2.2.0 is released.

Jeff Butler



On 7/10/06, jeremy jardin <je...@newtec.caisse-epargne.fr> wrote:
>
>   Ok thx !!
>
>
>
> So, by the way, is it possible to set that indicator using one method ?
>
> Something like 'criteria.setMobile ("xxxxx", "
> UtilisateurExample.EXAMPLE_EQUALS) ' ??
>
>
>
>
>
>
>
> -----Message d'origine-----
> *De :* Jeff Butler [mailto:jeffgbutler@gmail.com]
> *Envoyé :* lundi 10 juillet 2006 15:33
> *À :* user-java@ibatis.apache.org
> *Objet :* Re: selectByExample
>
>
>
> With the current version of Abator you do need to specify how the
> criterion will be applied.  So your code should look like this:
>
>
> UtilisateurExample criteria = new UtilisateurExample() ;
> criteria.setMobile ("0600000000"),
> criteria.setMobile_Indicator(UtilisateurExample.EXAMPLE_EQUALS );
>
> Jeff Butler
>
>
>
>
> On 7/10/06, *jeremy jardin* <je...@newtec.caisse-epargne.fr>
> wrote:
>
> Hi,
>
>
>
>
>
> I'm trying to use Ibatis in my application.
>
> I've also used Abator plugin to generate my javabeans and xml files.
>
>
>
> Today, I'm writing a bean Manager, used to store/delete/update datas in
> database.
>
> I want to write methods able to give list according to the beanExample.
>
>
>
> When I look in debug Mode how it works, I don"t understand.
>
> My junit test file just try to get a user from his phone number, and
> request answers the whole user list of my database.
>
>
>
> I proceed like that :
>
>
>
>         UtilisateurExample criteria = new UtilisateurExample( ) ;
>
>         Criteria.setMobile ("0600000000"),
>
>
>
>         ArrayList userList = new ArrayList() ;
>
>
>
>         UtilisateurDAOImpl userDao = new UtilisateurDAOImpl () ;
>
>
>
>         userDao.setSqlMapClient(sqlMap);
>
>
>
>         try
>
>         {
>
>             list = (ArrayList)userDao.selectByExample(criteria);
>
>         }
>
>         catch (SQLException e)
>
>         {}
>
>
>
> that code give me the whole user list (that' s not true, no one user in my
> database has that phonenumber)
>
> But if I precise :
>
>
>
>             Criteria.setMobileIndicator(1) ;
>
>
>
> It works well  !!
>
>
>
> I don't understand why should I set explicitly that mobileIndicator ???
>
> Am using ibatis the good way ??
>
>
>
> Thx !!
>
>
>
>
>
>
>