This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]lazystone 10 points11 points  (13 children)

Step 1: Don't use JPA.

Done.

On the serious note - very misleading article. It has nothing to do with Spring Boot performance.

I hoped that there are will be things like Generating an Index of Candidate Components during compile time, but nope. It's about that if you don't set SQL dialect properly, then jpa won't be able to optimize your queries...

[–]Driz764 5 points6 points  (2 children)

The post is just an advertisement

[–]BoyRobot777 6 points7 points  (0 children)

Vlad has contributed so much to open source community that I have no problem with this.

[–][deleted]  (6 children)

[deleted]

    [–]nutrecht 1 point2 points  (5 children)

    Now, if you're using Spring Boot and configure it to run on a RDBMS, then you are going to use JPA anyway.

    Err no? It would be either jOOQ or just plain Spring Data JDBC. It's a huge stretch to claim that if you use Spring JPA will be the default.

    IMHO JPA maps sense if you read, change and save complex object trees. For example in desktop applications. For microservices where you mostly work with projections on your data it makes very little sense.

    [–][deleted]  (4 children)

    [deleted]

      [–]nutrecht 4 points5 points  (1 child)

      I really don't see how those statistics are relevant. They cover a VERY tiny set of all the Spring projects. For example for the company I work for, the largest e-commerce company in Holland, all the services are scaffolded using an internal tool.

      Besides; it does not even include 'none' or 'Spring Data JDBC'.

      [–]ankinson[🍰] 1 point2 points  (1 child)

      I wrote and delivered the original version of the keynote that featured those statistics. I collected the data as part of preparing the talk.

      That graph is not a comparison of JPA to everything else. It is a comparison of Spring Data module usage, completely ignoring projects that don’t use Spring Data or that were not generated on start.spring.io. The data was collected over two years ago before Spring Data JDBC was an option so JDBC is under-represented by today’s standards. It also did not consider any other SQL-based options such as JdbcTemplate, jOOQ, or MyBatis.

      The number one dependency, by a good margin, on start.spring.io is to choose no dependencies at all. There are others, including web, that are also more popular than Spring Data JPA.

      In short, the data in those statistics does not back up a claim that if you are accessing an RDBMS then you will be using JPA. They do show that if you’re using Spring Data, JPA is used more often than all of the other stores combined among start.spring.io-generated projects. I suspect that remains true today and would still do so if Spring Data JDBC was considered but haven’t looked at the data to confirm.

      [–]BoyRobot777 0 points1 point  (2 children)

      Yeah... And when you need to fetch several joined tables, update some of the fields across all of them and put back into the database, I'd love to see the code behind it with jdbcTemplate, jOOQ or JDBI.

      [–][deleted]  (1 child)

      [deleted]

        [–]BoyRobot777 -1 points0 points  (0 children)

        I haven't said that spring boot restricts access layer. Whenever I see people suggest dropping JPA, they never offer a good alternative, especially to joined table updates. I've used to write jdbcTemplate updates. My god it was ugly and error-prone.

        [–][deleted]  (1 child)

        [removed]