ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jeremy jardin" <jeremy.jar...@newtec.caisse-epargne.fr>
Subject selectByExample
Date Mon, 10 Jul 2006 13:06:40 GMT
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 !!
 
                        

Mime
View raw message