You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Kristian Hellquist <kr...@student.lu.se> on 2005/03/09 18:35:32 UTC

Retrieving and setting Array from database

Hi!

Does Sqlmap has any support for handling arrays from in the database?

I get the following error when calling the function queryForList()

"No type handler could be found to map the property 'bar' to column
'bar'.  One or both of the types, or the combination of types is not
supported."


Database-table
Table "Foo"
--------+------------+-------------
Column | Type | Modifier
--------+------------+-------------
bar | smallint[] | not null

	

Sqlmap
<select id="getTest" resultClass="com.mycompany.Foo">
	select bar from foo
</select>


Java-class
class Foo {
  int[] bar;
    public void setBar(int[] bar){ this.bar = bar; }
    public int[] getBar(){ return bar; }
} 


Thanks in advance!
Kristian Hellquist






Re: Retrieving and setting Array from database

Posted by Kristian Hellquist <kr...@student.lu.se>.
I use sqlmap 2.0.9, postgresql 7.4 and jdbc-driver pg74.215.jdbc3

Thanks for your fast reply,
Kristian Hellquist 

On Wed, 2005-03-09 at 17:47 -0700, Brandon Goodin wrote:
> This would depend on what support your driver has for that
> functionality. It may be that you will need to write a Custom Type
> Handler. Could you provide the database you are using and  what
> version of sqlmap?
> 
> thanks,
> Brandon
> 
> 
> On Wed, 09 Mar 2005 18:35:32 +0100, Kristian Hellquist
> <kr...@student.lu.se> wrote:
> > Hi!
> > 
> > Does Sqlmap has any support for handling arrays from in the database?
> > 
> > I get the following error when calling the function queryForList()
> > 
> > "No type handler could be found to map the property 'bar' to column
> > 'bar'.  One or both of the types, or the combination of types is not
> > supported."
> > 
> > Database-table
> > Table "Foo"
> > --------+------------+-------------
> > Column | Type | Modifier
> > --------+------------+-------------
> > bar | smallint[] | not null
> > 
> > Sqlmap
> > <select id="getTest" resultClass="com.mycompany.Foo">
> >         select bar from foo
> > </select>
> > 
> > Java-class
> > class Foo {
> >   int[] bar;
> >     public void setBar(int[] bar){ this.bar = bar; }
> >     public int[] getBar(){ return bar; }
> > }
> > 
> > Thanks in advance!
> > Kristian Hellquist
> > 
> >


Re: Retrieving and setting Array from database

Posted by Brandon Goodin <br...@gmail.com>.
This would depend on what support your driver has for that
functionality. It may be that you will need to write a Custom Type
Handler. Could you provide the database you are using and  what
version of sqlmap?

thanks,
Brandon


On Wed, 09 Mar 2005 18:35:32 +0100, Kristian Hellquist
<kr...@student.lu.se> wrote:
> Hi!
> 
> Does Sqlmap has any support for handling arrays from in the database?
> 
> I get the following error when calling the function queryForList()
> 
> "No type handler could be found to map the property 'bar' to column
> 'bar'.  One or both of the types, or the combination of types is not
> supported."
> 
> Database-table
> Table "Foo"
> --------+------------+-------------
> Column | Type | Modifier
> --------+------------+-------------
> bar | smallint[] | not null
> 
> Sqlmap
> <select id="getTest" resultClass="com.mycompany.Foo">
>         select bar from foo
> </select>
> 
> Java-class
> class Foo {
>   int[] bar;
>     public void setBar(int[] bar){ this.bar = bar; }
>     public int[] getBar(){ return bar; }
> }
> 
> Thanks in advance!
> Kristian Hellquist
> 
>