简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM