Hibernate gives you three choices for writing queries. There is the Criteria Object which is building queries with Java objects. HQL is like writing SQL but instead of tables and fields, you use objects and object attributes. And the third is straight SQL, you can do any combination of them, so for one use case you might find it easiest to use Criteria, another HQL and yet a third in SQL.
You can call stored procedures with a couple caveats.
1. There can only be one out parameter from your SP and it must be the first parameter. 2. The out parameter can only be a ref cursor. It cannot be a custom data type et al.
Originally posted by Raj Ohadi: I just want to use hibernate to call a stored procedure that does not return anything but does some database insert and update. Is that feasible ? what's the standard syntax for this ?
Yes, it is pretty easy to set your mappings to call insert and update stored procedures instead of Hibernate generating the insert and update statements. For each class mapping you can include a <insert-sql> or <update-sql>. I am pretty sure those are the tags, I just don't memorize that stuff. But basically in each entity that you map you can include tags to tell Hibernate to call SPs instead of creating the SQL.