Chapter 14. Creating and executing queries

In this chapter

  • The basic query APIs

  • Creating and preparing queries

  • Optimizing query execution

If you’ve been using handwritten SQL for a number of years, you may be concerned that ORM will take away some of the expressiveness and flexibility you’re used to. This isn’t the case with Hibernate and Java Persistence.

With Hibernate’s and Java Persistence’s powerful query facilities, you can express almost everything you commonly (or even uncommonly) need to express in SQL, but in object-oriented terms—using classes and properties of classes. Moreover, you can always fall back to SQL strings and let Hibernate do the heavy lifting of handling the query result. For additional SQL resources, consult ...

Get Java Persistence with Hibernate, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.