pgsql exception

From: Ravi <nm(dot)ravi2005(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pgsql exception
Date: 2010-02-22 12:33:21
Message-ID: bf8f49251002220433x41b8de2ajd735810c4751a77e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2010-02-22 13:16:17 Re: exception in plsql
Previous Message beulah prasanthi 2010-02-22 12:11:11 exception in plsql