piotom
piotom

Reputation: 91

Hibernate: Multiple native queries grouped together

I run the following code successfully using hibernate and postgresql 9.1

session.createSQLQuery("delete from table_1; delete from table_2").executeUpdate();

My question is: Does hibernate officially support grouping native queries and running them together in one go? I was not able to find such information in manual. Are there any disadvantages or potential risks in using this solution?

Upvotes: 4

Views: 1916

Answers (1)

Jaffar Ramay
Jaffar Ramay

Reputation: 1165

You can't execute multiple queries like this, however if you need to execute them like this for any reason you can put these calls in a stored procedure and call that stored procedure. However I won't recommend to use a Stored Procedure.

Upvotes: 1

Related Questions