Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications

Optimize Java Persistence Performance in Spring Boot Applications
 
 
Apress
  • erscheint ca. am 25. Juli 2020
 
  • Buch
  • |
  • Softcover
978-1-4842-5625-1 (ISBN)
 
This book is a collection of developer code recipes and best practices for persisting data using Spring, particularly Spring Boot. The book is structured around practical recipes, where each recipe discusses a performance case or performance-related case, and almost every recipe has one or more applications. Mainly, when we try to accomplish something (e.g., read some data from the database), there are several approaches to do it, and, in order to choose the best way, you have to know the implied trades-off from a performance perspective. You'll see that in the end, all these penalties slow down the application. Besides presenting the arguments that favor a certain choice, the application is written in Spring Boot style which is quite different than plain Hibernate.

Persistence is an important set of techniques and technologies for accessing and using data, and this book demonstrates that data is mobile regardless of specific applications and contexts. In Java development, persistence is a key factor in enterprise, ecommerce, cloud and other transaction-oriented applications.

After reading and using this book, you'll have the fundamentals to apply these persistence solutions into your own mission-critical enterprise Java applications that you build using Spring.

What You Will Learn

  • Shape *-to-many associations for best performances
  • Effectively exploit Spring Projections (DTO)
  • Learn best practices for batching inserts, updates and deletes
  • Effectively fetch parent and association in a single SELECT
  • Learn how to inspect Persistent Context content
  • Dissect pagination techniques (offset and keyset)
  • Handle queries, locking, schemas, Hibernate types, and more

Who This Book Is For

Any Spring and Spring Boot developer that wants to squeeze the persistence layer performances.

1st ed.
  • Englisch
  • CA
  • |
  • USA
  • Für Beruf und Forschung
Approx. 300 p.
  • Höhe: 25.4 cm
  • |
  • Breite: 17.8 cm
978-1-4842-5625-1 (9781484256251)
weitere Ausgaben werden ermittelt

Anghel Leonard is a Chief Technology Strategist with 20+ years of experience in the Java ecosystem. In daily work, he is focused on architecting and developing Java distributed applications that empower robust architectures, clean code, and high-performance. Also passionate about coaching, mentoring and technical leadership. He is the author of several books, videos and dozens of articles related to Java technologies.

Best Practices For Spring Boot Persistence Layer In Production-------------------------------------------------------------- Must know/have-------------------------------------------------- Item x: How to enable dirty tracking Item x: How to disable Open Session in View Entities and Associations-------------------------------------------------- Item x: How to effectively shape one-to-many association Item x: How to effectively shape many-to-many association Item x: How to filter associations via @Where Item x: How to empower Fluent API in entities Item x: How to batch associations Item x: How to decide between List and Set in many-to-many associations Item x: How to populate a child-side parent association via proxy Item x: How to use Optional in entities Fetching (DTOs)-------------------------------------------------- Item x: How to lazy load the entity attributes via Hibernate bytecode instrumentation Item x: How to lazy load the entity attributes via subentities Item x: How to fetch DTOs via Spring projections Item x: How to enrich Spring projections with virtual properties that are (aren't) part of entities Item x: How to fetch DTOs via constructor (expression) Item x: How to fetch DTOs via JPA Tuple Item x: How to fetch DTOs via @SqlResultSetMapping and @NamedNativeQuery Item x: How to fetch DTOs via ResultTransformer Item x: How to fetch DTOs via @Subselect Item x: How to fetch DTOs via Blaze-Persistence entity views Item x: How to delay connection acquisition Item x: How to avoid redundant save() calls Item x: How to effectively fetch parent and association in a single SELECT Item x: How to decide between JOIN and JOIN FETCH Item x: How to stream data via MySQL ... Batching-------------------------------------------------- Item x: How to batch inserts in Spring style Item x: How to effectively batch updates Item x: How to effectively batch deletes Item x: How to effectively batch associations Item x: How to batch files via fork/join framework ... Collections-------------------------------------------------- Item x: How to deal with @OrderColumn and @ElementCollection Item x: How to merge collections Item x: How to fetch @ElementCollection ... Connections-------------------------------------------------- Item x: How to delay database connection until is really needed Identifiers-------------------------------------------------- Item x: How to avoid Hibernate 5 AUTO Generator Type in MySQL Item x: How to optimize identifiers generation via hi/lo algorithm Item x: How to handle Lombok @EqualsAndHashCode and @Data Item x: How to use Hibernate natural ids in Spring style ... Computing-------------------------------------------------- Item x: How to calculate property value via @Formula Item x: How to calculate property value via @Generated Item x: How to calculate property value via PostLoad Item x: How To execute SQL functions With multiple parameters in a JPQL query ... Monitoring-------------------------------------------------- Item x: How to count the number of triggered SQLs via datasource-proxy Item x: How to count the number of triggered SQLs via p6spy Item x: How to view the binding parameters via log4jdbc Item x: How to view the binding parameters via log4j2 Item x: How to view the binding parameters via TRACE ... Configuring DataSource and connection pool-------------------------------------------------- Item x: How to configure HikariCP Item x: How to configure C3PO Item x: How to configure ViburDBCP Item x: How to configure BoneCP Item x: How to configure DBCP2 Item x: How to configure DataSource programatically Item x: How to configure DataSource declaratively Item x: How to configure two DataSource ... Audit-------------------------------------------------- Item x: How to audit via Spring capabilities Item x: How to audit via Hibernate Envers ... Schemas-------------------------------------------------- Item x: How to set up Flyway Item x: How to auto-create and migrate database schema in MySQL via Flyway Item x: How To auto-create and migrate two schemas in PostgreSQL using flyway Item x: How to set up Flyway with two vendors Item x: How to match schema via @Table ... Pagination-------------------------------------------------- Item x: How to implement keyset pagination with Next Page button Item x: How to take advantage of slicing and findAll() Item x: How to optimize offset pagination via window functions ... Queries-------------------------------------------------- Item x: How to optimize DISTINCT queries Item x: How to deal with JPA callbacks Item x: How to use Query Creation mechanism for JPA to limit result size Item x: How to deal with queries in Spring post-commits Item x: How to avoid redundant save() calls Item x: How to simulate N+1 performance penalties Item x: How to decide which JPA inheritance strategy fits the best Item x: How to implement soft deletes Item x: How to avoid lazy initialization caused by Open Session In View anti-pattern Item x: How to store date and time in UTC timezone ... Locking-------------------------------------------------- Item x: How to use SKIP_LOCKED Item x: How to retry optimistic locking exceptions Item x: How to implement versioned optimistic locking Item x: How to implement version-less optimistic locking ... Hibernate Types-------------------------------------------------- Item x: How to store java.time.YearMonth as integer or date Via hibernate types ...
This book is a collection of developer code recipes and best practices for persisting data using Spring, particularly Spring Boot. The book is structured around practical recipes, where each recipe discusses a performance case or performance-related case, and almost every recipe has one or more applications. Mainly, when we try to accomplish something (e.g., read some data from the database), there are several approaches to do it, and, in order to choose the best way, you have to know the implied trades-off from a performance perspective. You'll see that in the end, all these penalties slow down the application. Besides presenting the arguments that favor a certain choice, the application is written in Spring Boot style which is quite different than plain Hibernate.

Persistence is an important set of techniques and technologies for accessing and using data, and this book demonstrates that data is mobile regardless of specific applications and contexts. In Java development, persistence is a key factor in enterprise, ecommerce, cloud and other transaction-oriented applications.

After reading and using this book, you'll have the fundamentals to apply these persistence solutions into your own mission-critical enterprise Java applications that you build using Spring.

You will:

- Shape *-to-many associations for best performances
- Effectively exploit Spring Projections (DTO)
- Learn best practices for batching inserts, updates and deletes
- Effectively fetch parent and association in a single SELECT
- Learn how to inspect Persistent Context content
- Dissect pagination techniques (offset and keyset)
- Handle queries, locking, schemas, Hibernate types, and more

Noch nicht erschienen

ca. 37,44 €
inkl. 7% MwSt.
Vorbestellen