15

JPA: lazy loading for lazy developers, the performance issue

 4 years ago
source link: https://marco.dev/2009/03/09/jpa-performance-inser/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

java-version.com: What's new in Java 16? 15? Keep up to date!

JPA: lazy loading for lazy developers, the performance issue

I found and interesting article about loading and reading data with JPA. There are performance issues when you want to insert 1’000 or 10’000 records in the database.

Before ORM life was complicated … 25 lines of code to insert a line in the database, not it’s easier: entityManager.persist(object)!

The frameworks (Hibernate, Toplink …) do all the work and they do very well the work. The problem with JPA is that we cannot flush the session like in hibernate and send 50 or 100 records in a block to the DB. JPA send and retrieve each object in a transaction. Inserting 10’000 records takes minutes … 1’000’000 hours.

The solution is to use direcly JDBC, ETL product or frameworks (Spring Batch, …).

JPA is something great but it cannot manage everything 🙁 no party for the lazy developers … yet!

Author

Marco Molteni

Marco Molteni Blog


Recommend

  • 84
    • www.tuicool.com 6 years ago
    • Cache

    Vue Lazy Image Loading

    Vue Lazy Image Loading Vue progressive image and background loading plugin. Installation npm install vue-lazy-image-loading Usage import Vue from 'vue' import VueLa...

  • 47
    • www.tuicool.com 6 years ago
    • Cache

    Lazy Loading with Angular

    To explore how to add lazy loading functionality to an Angular app, this article will go through the process of building a relatively small application called Tour of Thrones .

  • 74
    • www.tuicool.com 6 years ago
    • Cache

    Native image lazy-loading for the web

    In this post, we'll look at the new loading attribute which brings native <img> and <iframe>...

  • 39
    • www.tuicool.com 5 years ago
    • Cache

    Understanding lazy loading in JavaScript

    Introduction In this post, we are going to look at how lazy loading works on the web. We will cover the native lazy loading API — how lazy loading is implemented, the importance and advantages of lazy loading,...

  • 14
    • www.bensmithett.com 4 years ago
    • Cache

    An argument against lazy loading

    An argument against lazy loadingMonday, February 25th 2019Opinion: Most of the time, I really dislike using websites that lazy load images.(Yeah, this post is full of my opinions. Yours may differ. That's...

  • 24
    • chintanrathod.com 4 years ago
    • Cache

    [Kotlin] Lazy Loading – Android

    [Kotlin] Lazy Loading – Android You can find several benefits of using lazy loading in your application. Lazy loading will result in faster startup due to loading is deferred when variable is accessed. This is very usefu...

  • 9

    Natively lazy-loading Facebook social plugins July 24th, 2020. Tagged: facebook,

  • 10

    SharesubscribeThe performance effects of too much lazy-loadingData-driven advice for lazy-loading images with Core Web Vitals in mind.Jul 15, 2021Lazy-loading is...

  • 3

    Effects of Too Much Lazy Loading on Web PerformanceUse the right amount of lazy loading to improve web app performanceToday, lazy loading is widely used in web applications to improve application perfor...

  • 7

    Add Lazy Loading in Your Website for Better Website Performance   979 views   5 months ago Javascript Lazy loading i...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK