ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingmar Lötzsch <iloetz...@asci-systemhaus.de>
Subject Re: Data mapper help ...please
Date Wed, 04 Feb 2009 08:16:43 GMT
Hello Rahul,

> I am very new to Ibatis so I need some help in regard to, How I can 
> register my ArrayToStringtypehandlercallback for a particular field.
> 1)  I know that I can declare my typehandler in sqlmapConfig file but if 
> I do so, that means declaring it for every parameter of the same type , 
> i.e globally , which I do not want as it would result in my typehandler 
> being called every time when it would encounter that type in any other 
> parameter class ( please correct me if I am wrong   or will it will be 
> called only where I actually specify it like in inline parameters I am 
> doing in my sqlmap resource file? And do not register this in my 

<typeAlias alias="IntArrayTypeHandler" 
type="com.asci.common.ibatis.IntArrayTypeHandler" />
> 2) what is the syntax for declaring my typehandler locally ?
<select id="selectByIds" parameterClass="map" resultMap="result" >
	<include refid="selectFragment"/>
	FROM dispovariante AS dv
	WHERE dv.id = ANY (#ids,handler=IntArrayTypeHandler#)

In the DAO write something like

public List<Dispovariante> selectByIds(Set<Integer> ids)
	HashMap<String, Object> params = new HashMap<String, Object>();
	params.put("ids", ids);
	List<Dispovariante> list = getSqlMapClientTemplate().queryForList(
		"dispovariante.selectByIds", params);
	return list;


View raw message