I need to let a user to create a function by insering sql code.
The code is in PL/PgSQL.
Code:
String sql = "CREATE OR REPLACE FUNCTION myFunction ..."
... //very long function...
sql +=" end; $BODY$ language 'plpgsql' VOLATILE;";
session.CreateSQLQuery(sql).executeUpdate();
If I execute the code in a program such pgAdmin, the function is created correctly.
But when I try to execute the code with an hibernate sqlquery I get this exception:
java.lang.UnsupportedOperationException: Update queries only supported through HQLWhy must I use only HQL?
I want to use my code, how can I do that?