Hibernate 7 @NamedStoredProcedureQuery — merged into the Hibernate 7 stored procedures guide
This article has been merged into the fuller Hibernate 7 stored procedures guide, which covers @NamedStoredProcedureQuery, StoredProcedureQuery and ProcedureCall together — and, unlike either original, actually executes the procedures it describes.
This article has moved. Everything that was here — defining a procedure on an entity with @NamedStoredProcedureQuery, registering IN, OUT and INOUT parameters, calling it from Java, and the pitfalls around parameter binding — now lives in a single, larger article that also covers the programmatic StoredProcedureQuery and ProcedureCall APIs:
The two articles had grown to cover the same ground from two directions, which meant the annotation-driven half and the programmatic half were being explained separately and neither was complete. They are now one article.
The merged version is also the first of the two to actually run what it describes. The examples here were written against MySQL syntax and never executed; the replacement executes real SQL/PSM procedures against HSQLDB 2.7.3 on Hibernate 7.4.5.Final, with the transcripts committed to a companion repository. That turned up several things this article got wrong — among them that a mismatched parameter name does not fail the way you would expect, and that forgetting execute() is not actually a failure mode at all.
No Comments yet!