Best Practices and Advanced Techniques
Autor: | Brian D. Murphy, Paul Tepper Fisher |
---|---|
Rok vydání: | 2010 |
Předmět: | |
Zdroj: | Spring Persistence with Hibernate ISBN: 9781430226321 Spring Persistence with Hibernate ISBN: 9781484202692 |
DOI: | 10.1007/978-1-4302-2633-8_9 |
Popis: | In this chapter, we examined several strategies for evaluating and improving application performance. One of the most common pitfalls for Hibernate developers is the N+1 selects issue. This problem typically stems from a failure to properly tune a domain object’s mapping configuration or the queries within the DAO layer. Understanding how this problem can appear, as well as how to detect it, is important in ensuring decent ORM performance. Although tuning really depends on the unique requirements of an application, often the best solution is to consider what data needs to be made available within the service, controller, or view layers, and optimize your queries to load this data as efficiently as possible. You saw that using a fetch-join is often an effective approach for initializing an association without requiring multiple queries. Relying on Hibernate’s batching capability can also be a decent strategy, although it isn’t always as effective. |
Databáze: | OpenAIRE |
Externí odkaz: |