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

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(); 

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

Tool.xml :
  <statement id="getMaxId" resultClass="java.lang.Integer" 
        SELECT MAX(#index#) 
        FROM (#nom#)

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: 
--- 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 ?


Stephane Chapeau,

View raw message