ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brice Ruth <bdr...@gmail.com>
Subject Re: Help needed with Postgres Varchar [] -> String []
Date Fri, 18 Feb 2005 04:29:07 GMT
It doesn't appear you are using a CustomTypeHandler ... this is
necessary as iBATIS does not support Postgres' ARRAY type.


On Mon, 14 Feb 2005 06:52:17 -0500, William Harding
<bharding@dcddesigns.com> wrote:
> Greetings all,
> 
> I have spent the last 2 days researching how to handle the Postgres data
> type: VARCHAR[] and how to map it to a String[] with little to no luck.
> I am fairly new to iBATIS and I could have easily missed something very
> simple.
> 
> Here is what I have.
> 
> My Current mapping is as follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-2.dtd">
> 
> <sqlMap namespace="CandidateInfo">
> <typeAlias alias="candidateinfo" type="candidateinput.CandidateInfo"/>
> 
> <insert id="insertCandidateInfo" parameterClass="candidateinfo">
>     INSERT INTO candidate_info (
>         c_candidate_id,
>         c_f_name, c_m_initial, c_l_name, c_address_line_one,
> c_address_line_two, c_city, c_state, c_zipcode,
>         c_country, c_email, c_areacode, c_primary_phone,
> c_cell_areacode, c_cellphone,  c_biz_areacode,
>         c_biz_phone, c_biz_phone_ext, c_lang_spoken,
> c_will_work_part_contract,  c_resume_fliename, c_db_entry_date )
>     values (
>         (select MAX(c_candidate_id) from candidate_info) + 1,
>         #FName#, #MI#, #LName#, #addyOne#, #addyTwo#, #city#, #state#,
> #zipcode#,
>         #country#, #emailAddy#, #homeArea#, #homePhone#, #cellArea#,
> #cellPhone#, #workArea#,
>         #workPhone#, #workExt#, #languagesSpoken#, #willWorkPartCont#,
> #resumeFilename#, current_date )
> </insert>
> 
> </sqlMap>
> 
> The languagesSpoken parameter is a String[10] in the CandidateInfo
> object and is a VARCHAR[10] in the Postgresql database. I have tried
> various ways of setting the data type and nothing has worked.
> 
> Each time I execute this mapping I get the following error:
> 
> There was a sql Exception:
> com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
> occurred in CandidateInfo.xml. --- The error occurred while applying a
> parameter map. --- Check the insertCandidateInfo-InlineParameterMap. ---
> Check the parameter mapping for the 'languagesSpoken' property. ---
> Cause: java.lang.NullPointerException Caused by:
> java.lang.NullPointerException
> 
> I have done several tests ranging from not setting any of the array
> items to filling them all in order to make sure that they are not null.
> My only question is how to I go about handling this issue?
> 
> Is this a mapping issue or quite possibly a data issue? How do I even go
> about debugging this?
> 
> Any help would be greatly appreciated.
> 
> Thanks.
>

Mime
View raw message