ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane Chapeau <s.chap...@c3consultants.fr>
Subject Select max(#A#) from (#B#) error
Date Tue, 04 Apr 2006 07:21:01 GMT
Hello,

I try to pass argument by a class, by xml map and by this method. And it's 
always the same problem :

public class MetSqlMapDao extends BaseSqlMapDao implements MetDao { 
 [...]
        public void getMax() { 
                Hashtable ht = new Hashtable(); 
                ht.put("index","idMeti"); 
                ht.put("nom","metiers");                                

                log.debug((Integer)queryForObject("getMaxId", ht));     
        }

Tool.xml :
[...]
  <statement id="getMaxId" resultClass="java.lang.Integer" 
parameterClass="java.util.Map">
        SELECT MAX(#index#) 
        FROM (#nom#)
  </statement>

And I have the folowing error, it seems like ibatis don't set the right 
arguments :

 com.ibatis.dao.client.DaoException: Failed to execute queryForObject - id 
[getMaxId], parameterObject [{nom=metiers, index=idMeti}].  Cause: 
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in org/c3/emc3/persistence/sqlmapdao/sql/Tool.xml.  
--- The error occurred while applying a parameter map.  
--- Check the getMaxId-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: ERREUR: syntax error near «$2»

If I put directly the parameters in the XML file for the SQL request, the 
result is ok. I don't see where is the problem ?

Thanks

-- 
Stephane Chapeau,


Mime
View raw message