What is the recommended way to truncate a table using hibernate/hql?
I\'ve tried this:
Query query = session.createQuery(\"truncate table MyTable\"); qu
You can use session.createSQLQuery() instead:
session.createSQLQuery()
session.createSQLQuery("truncate table MyTable").executeUpdate();
Needless to say, this is not ideal in terms of portability. It's probably a good idea to define this query in mapping and retrieve it in code as named query.