Hi I have a problem to call a stored function on insert.
I tried this in the .hbm.xml for my test class:
<sql-insert>exec employeesinsert ?,?,?,?,?</sql-insert>
but the error was: syntax error at or near "exec"
I also tried this:
<plpgsql-insert>exec employeesinsert ?,?,?,?,?</plpgsql-insert>
But received: 'urn:nhibernate-mapping-2.2' has invalid child element 'plpgsql-insert'
The function is:
CREATE OR REPLACE FUNCTION employeesinsert(_name text, _surname text, _email text, _t integer)
RETURNS void AS
$BODY$
BEGIN
INSERT INTO employees (id, name, surname, email, "type")
VALUES (_id, _name, _surname, _email, '_t');
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION employeesinsert(text, text, text, integer) OWNER TO root;
Can anybody give an example how to do this?
Thanks in advance.
|