I'm trying to run this query
drop FUNCTION IF EXISTS time_factor;
I want to run it through the Hibernate session with either createSQLQuery()
or doWork()
.
Like this:
sessionFactory.getCurrentSession().createSQLQuery(query).executeUpdate();
or
sessionFactory.getCurrentSession().doWork(new Work() {
@Override
public void execute(Connection connection) throws SQLException {
connection.prepareStatement(query).executeUpdate();
}
});
This is what I get:
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "DROP FUNCTION[*] IF EXISTS TIME_FACTOR; "; expected "TABLE, INDEX, USER, SEQUENCE, CONSTANT, TRIGGER, VIEW, ROLE, ALIAS, SCHEMA, ALL, DOMAIN, TYPE, DATATYPE, AGGREGATE";
Does this mean that I can't drop functions through JDBC/Hibernate ?
Also if someone knows a way I can run it I'd be really grateful.