Hibernate error: "could not execute native bulk manipulation query"
I was getting this error:
exception: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
After looking in more than 25 google results I couldn't find any clue about what could be happening. But somehow I got illuminated and found what was happening. That's why I'm writing this post.
This was my code before I saw the problem:
Let Me tell you something about this error. I'm not a hibernate crack, but as you can see it's saying that you can't create a bulk delete on a sql query by using hibernate.
The error in this code is that I was executing a HQL script using createSQLQuery method which is completely wrong, I should use createQuery.
So there's nothing much to say, If you want to make a bulk task like an update of multiple records or a deletion of multiple rows using a simple query, you MUST use a HQL query.
Hope that helps a little!
Matias Paterlini