pgsql exception.

Поиск
Список
Период
Сортировка
От Ravi
Тема pgsql exception.
Дата
Msg-id bf8f49251002220441h1089e658j78237c8b4afdcc91@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
Hi,
while passing util list to Postgres stored procedure getting  an exception saying
org.postgresql.util.PSQLException: Cannot cast an instance of java.util.ArrayList to type Types.ARRAY
 can you help to resolve it? its urgent

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-general по дате отправления:

Предыдущее
От: AI Rumman
Дата:
Сообщение: tsearch2 gives NOTICE: word is too long
Следующее
От: "mike stanton"
Дата:
Сообщение: ECPG: No multidimensional array support for simple data types