Skip to main content

Abstract

In this chapter, we introduced some core ORM concepts, and you learned more about how Spring and Hibernate can be used together. We also reviewed some key design patterns that are instrumental to the way in which Spring integrates with many persistence frameworks. Through our gallery application examples, we demonstrated how to implement an effective DAO layer. We examined several options for integrating Hibernate—using the HibernateTemplate as well as using the Hibernate Core APIs.

The DAO pattern is considered a best practice for abstracting persistence-related functionality. Using Hibernate, we demonstrated how to load entities via their identifier, save or update individual entities, and query for domain objects using HQL. We discussed some querying techniques and examined various approaches for performing joins, using both implicit and explicit forms. We also contrasted implementation strategies using Spring’s HibernateTemplate and Hibernate Core APIs. Although HibernateTemplate has played a significant role in both Spring and Hibernate’s history, its use is becoming less important due to improvements to the Hibernate architecture after version 3.0.1.

This chapter discussed several implementation options for building our gallery application’s DAO layer. We built on some of the concepts introduced in the previous chapter, which illustrated mapping strategies for our application’s domain model. In the next chapter, we will build on the DAO layer introduced in this chapter, demonstrating how the service layer can be used to define an application’s transactional business logic.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Editor information

Steve Anglin Tom Welsh Mark Beckner Ewan Buckingham Gary Cornell Jonathan Gennick Jonathan Hassell Michelle Lowman Matthew Moodie Duncan Parkes Jeffrey Pepper Frank Pohlmann Douglas Pundick Ben Renow-Clarke Dominic Shakeshaft Matt Wade Mary Tobin Marilyn Smith

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Paul Tepper Fisher and Brian D. Murphy

About this chapter

Cite this chapter

Fisher, P.T., Murphy, B.D. (2010). DAOs and Querying. In: Anglin, S., et al. Spring Persistence with Hibernate. Apress. https://doi.org/10.1007/978-1-4302-2633-8_6

Download citation

Publish with us

Policies and ethics