Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 80427 invoked by uid 99); 14 Feb 2005 19:54:24 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of bdruth@gmail.com designates 64.233.184.206 as permitted sender) Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.206) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 14 Feb 2005 11:54:22 -0800 Received: by wproxy.gmail.com with SMTP id 69so677526wra for ; Mon, 14 Feb 2005 11:54:21 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=f2WUirvfWixaskvK3XQmDfUObQVUjO9FnjTHtcAA0kzDIZEJLziCZ1PMJ0eB1ehwaSKyUjF/KT2FJtowRE+AgHkMZe5vhIwNrxXgbRDZaWbwQlVAmqsgjY4IXBTRAFeQJo50Yv0ZcoaRTtVgrHWk7PgdKt+ZpYgh9VGQ8XYN8cg= Received: by 10.54.40.56 with SMTP id n56mr206080wrn; Mon, 14 Feb 2005 11:54:20 -0800 (PST) Received: by 10.54.40.24 with HTTP; Mon, 14 Feb 2005 11:54:20 -0800 (PST) Message-ID: Date: Mon, 14 Feb 2005 13:54:20 -0600 From: Brice Ruth Reply-To: Brice Ruth To: ibatis-user-java@incubator.apache.org Subject: Re: Help needed with Postgres Varchar [] -> String [] - Repost In-Reply-To: <4210FC13.4060306@dcddesigns.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <4210E123.4050609@dcddesigns.com> <4210FC13.4060306@dcddesigns.com> X-Virus-Checked: Checked Since this is not a standard JDBC type (that I know of), you'll probably need to write a custom type handler. Others can correct me if I'm wrong ... but looking through the iBATIS manual, I don't see any support for that. On Mon, 14 Feb 2005 14:29:23 -0500, William Harding wrote: > It is in fact an array of Varchar. Postgres is an object orieanted db so > it does allow for that. For example (in the code listed below) we want > to store the candidates languages with them in that row. So a Varchar[] > array is the best way to deal with it. Otherwise it means setting up a > foreign keyd table and doing joins, etc..... > > > Brice Ruth wrote: > > >So, in Postgres, its an array of Varchar?! That seems awfully odd, but > >I'm not that familiar with Postgres. If this is not in fact the case, > >and you're create a Varchar(10) (length of 10) - then that should be > >mapped to a simple String object, not an Array of String (String[]). > > > >Brice > > > > > >On Mon, 14 Feb 2005 12:34:27 -0500, William Harding > > wrote: > > > > > >>*Note* - This is a second submission. I apologize if this is a repeat. I > >>have been having so many problems with my ISP lately I don't know if > >>this was ever sent through the first time. ** > >> > >>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: > >> > >> > >> >>"http://www.ibatis.com/dtd/sql-map-2.dtd"> > >> > >> > >> > >> > >> > >> 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 ) > >> > >> > >> > >> > >>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? I have tried > >>using an tag to build the array by hand. > >> > >>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. > >> > >> > >> > >> > > > > > > > > > > >