O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Named SQL and HQL queries

Named queries refer to SQL or HQL queries that are defined declaratively in the mapping files, but are called programmatically in the Java code. The syntax of named SQL and HQL queries is the same as the syntax of ordinary SQL and HQL queries, which are defined in the Java code. They could include either JDBC-like positional parameters (?) or named parameters.

Named queries have many benefits. At first, their syntax is checked at deploy time, and not during program execution. You can have several different named queries and easily switch from one to another during development. Additionally, because they are kept separated from Java code, they are easy to maintain. During application, development or deployment can easily ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required