typecast exception - Mailing list pgsql-bugs

From beulah prasanthi
Subject typecast exception
Date
Msg-id 70c5fd1a1002220353i71b33218o418b56879f70d8ef@mail.gmail.com
Whole thread Raw
List pgsql-bugs
---------- Forwarded message ----------
From: Ravi <nm.ravi2005@gmail.com>
Date: Mon, Feb 22, 2010 at 5:21 PM
Subject:
To: Prasanthi <itsbeulah@gmail.com>


Method in Dao
public void savePerson(Person person, List<Address> addresses, List<Email>
emails, List<Phone> numbers){
        call.withProcedureName("
person_save1");

        Map<String, Object> out = call.execute(new
PGPerson(person),addresses,null,null);

    }

*SP in Database*

CREATE OR REPLACE FUNCTION person_save(person_to_save person, addresses
address[], emails email[], numbers phone[])
  RETURNS void AS
$BODY$
DECLARE
    per_id bigint;
BEGIN
IF person_to_save.id


IS NULL OR person_to_save.id


= 0 THEN
    SELECT INTO per_id nextval('people_id_seq');
    INSERT INTO person (id, first_name,last_name,middle_name) values
(per_id, person_to_save.first_name, person_to_save.last_name,
person_to_save.middle_name);
ELSE
    per_id := person_to_save.id


;
    UPDATE person SET first_name=person_to_save.first_name,
last_name=person_to_save.last_name, middle_name=person_to_save.middle_name
WHERE id = person_to_save.id


;
END IF;
IF addresses IS NOT NULL THEN
    EXECUTE person_addresses_save(per_id, addresses);
END IF;
IF emails IS NOT NULL THEN
    EXECUTE person_emails_save(per_id, emails);
END IF;
IF numbers IS NOT NULL THEN
    EXECUTE person_phones_save(per_id, numbers);
END IF;
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION person_save(person, address[], email[], phone[]) OWNER TO
postgres;
COMMENT ON FUNCTION person_save(person, address[], email[], phone[]) IS
'Saves a person.  If the person is new they will insert or if they exist
they will update.
Will do the same for the other objects also addresses, emails, phone';


*exception raised is

org.postgresql.util.PSQLException: Cannot cast an instance of
java.util.ArrayList to type Types.ARRAY
*
--
Ravi.T
BayLogic Technologies India Pvt. Ltd.
Vizag.

pgsql-bugs by date:

Previous
From: beulah prasanthi
Date:
Subject: typecast exception
Next
From: beulah prasanthi
Date:
Subject: exception in plsql