ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Broderick, Kevin" <kevin.broder...@iona.com>
Subject RE: Select max(#A#) from (#B#) error
Date Tue, 04 Apr 2006 07:38:02 GMT
Hi Stéphane,
Perhaps there is a problem with passing a Hashtable to a sql statement that is expecting a
If you use HashMap in your class and java.util.HashMap as your parameterClass this should

-----Original Message-----
From: Stéphane Chapeau [mailto:s.chapeau@c3consultants.fr] 
Sent: 04 April 2006 08:21
To: user-java@ibatis.apache.org
Subject: Select max(#A#) from (#B#) error


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