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: IBatis Array feild insertion problem in postgres database()Please help me)
Date Thu, 05 Nov 2009 09:34:04 GMT
You can use a result map and have to modify the IntArrayTypeMapper class
to return int[] instead of Array (actual type for example
org.postgresql.jdbc3.Jdbc3Array).

<resultMap id="result" class="..." >
	...
	<result column="kms_usr_otherusergroups"
property="kms_usr_otherusergroups" typeHandler="IntArrayTypeHandler" />
</resultMap>
	
<select id="select" parameterClass="int" resultMap="result" >
	SELECT
		...
	 	kms_users.kms_usr_otherusergroups,
		...
	FROM kms_users
	WHERE kms_users.kms_usr_userid = #value#
</select>

public class IntArrayTypeMapper
{
	...

	public Object getResult(ResultGetter getter)
	throws SQLException
	{
		Array array = getter.getArray();
		Object intArray = array.getArray();
		return intArray;
	}

	...
}

array.getArray() returns an int[] in case of a column of type int[] in
database.

>  SELECT
> 	kms_users.kms_usr_userid,
> 	kms_users.kms_usr_username,
> 	kms_users.kms_usr_userstatus,
> 	kms_users.kms_usr_otherusergroups,-->This is query field and how to put in
> handler=IntArrayTypeMapper for select query
> 	kms_users.kms_usr_emailid
> 
> WHERE
> 	kms_users.kms_usr_userid =#kmsusrid#
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message