22 December 2021

The First Annual Recap from JPA Buddy


Let us start with a few words about the history behind JPA Buddy. The idea of JPA Buddy as a plugin for IntelliJ IDEA was born back in 2019. Roots come from another product called Jmix (previously CUBA Platform). Jmix is both a framework and specialized tooling for productive business application development. As you may guess its data layer is built over JPA; its tooling, Jmix Studio, provides great facilities to express your data model via JPA entities nearly without manual coding.

Such a great visual designer has become one of the most loved parts among community members, however, to use it you must have your application developed on the Jmix framework. Obviously, this factor tremendously narrows down the audience of those who can benefit from the JPA entity designer built into your favorite IDE. Finally, we decided to provide an independent plugin for IntelliJ IDEA that could benefit every developer who uses JPA for the persistence layer.

Development Challenges

JPA is a vast specification. As I mentioned we branched out JPA Buddy from Jmix, where only a narrow subset of the specification was supported. Obviously, implementing the whole thing is impossible, especially when you have a team of 2 developers. We had to study the entire spec up and down and run a hundred surveys to understand what our typical user is actually using.

JPA has more than one implementation. Not a secret, that Hibernate dominates in the family of JPA implementations, but still, it is not even close to 100%. The same story can be told about Spring with its Spring Data JPA – dominates but does not fill the full market; we also have Java EE, Quarkus, Micronaut, Helidon, etc. So, another challenge we stumbled upon is the fact JPA Buddy must generate code strictly depending on the target application nature and its dependencies, not even saying about chosen Java and Kotlin.

The initial look of the entity wizard was inherited from Jmix. It was designed for developers who don't know much about JPA and even Java and it did its job. However, after a few initial demos it became clear that JPA Buddy is going to have a different audience of professional Java developers. Unlike the Jmix entity designer, JPA Buddy never hides the source code under a visual designer. It gently offers a number of options you may follow within the JPA paradigm and accompanies code generation with intuitive wizards, so developers can use the power of all useful features even without remembering or even knowing them all.

Finally, working with existing sources is a big challenge. JPA Buddy is a buddy, not a master. The tool is only allowed to give you advice, but not mess up your code silently. So, we need to generate code snippets in a way that doesn’t introduce unwanted and unexpected modifications. To make it possible we needed to train JPA Buddy on how to understand your custom code. It took us quite a long while to learn how to parse sources without having our plugin crash.


Since we realized that the Jmix approach for visual designers doesn't meet the target audience expectation we decided to state the main goals of what we want to achieve with JPA Buddy:

  1. Make the barrier to entry into JPA as low as possible
  2. Make the development process slicker and faster
  3. Ensure idiomatic use of the chosen JPA implementation

As for code generation and inspections, we thoroughly study the subject to make sure they follow the specification, documentation and best practices. Here we must thank Eugen Paraschiv the author of baeldung.com, Vlad Mihalcea, and Thorben Janssen – who granted to the Java community an immense number of extremely useful articles and videos about JPA, Hibernate and Spring Data.

2021 Recap

2021 was an amazing year for the JPA Buddy team. Let's leaf through some of the achievements:

Let's remember the major functionality delivered in 2021:

  • Visual Designers for
    • JPA Entities
    • Spring Data JPA interfaces
    • Liquibase changelogs
    • SQL files and Flyway migrations
    • DTOs generation with MapStruct support
  • Coding Assistance
    • Kotlin support
    • Code inspections checking the validity of entities
    • Code inspections ensuring safe use of Lombok
    • A vast set of code generation actions, available via hotkeys and quick-fixes
  • Database versioning
    • Automatic generation of Liquibase changelogs
    • Automatic generation of Flyway versioned migrations
    • Smart prompts for unsafe DDL operations
  • Reverse engineering
    • Generating entities from DB tables
    • Adding attributes to existing entities based on DB columns
    • Caching for remote DBs

Cannot believe that such a small team has managed to get on top of all these!

Community Research

JPA Buddy is just a tool. That’s why we always try to keep our personal views aside, but focus on the objective opinion of JPA users. In 2021 we managed to gather some information from our community that we would like to share with you in this section.


Seems there is no Java developer who is not radical towards Lombok. Developers either love it or hate it. Well, there is also a group of developers who haven't heard of it yet. The fact proving it is that our most engaged tweet is about Lombok. Unfortunately, Lombok also causes one of the most systematic errors when using it with JPA entities. To learn more about it read this article in our blog. A Lombok-related article also happened to be the most read blog post in 2021. Summarizing two publications on dzone.com and jpa-buddy.com it earned nearly 20K readers since its publication in the middle of April.


JPA Buddy introduced Kotlin at the end of April 2021. At that time, we didn't expect that the tandem of Kotlin and JPA will occupy up to 15% of JPA Buddy use. Another surprise was that we couldn't google for an anyhow complete guide for using JPA in a Kotlin application. The most scarring was the fact that almost every resource provides wrong code samples: some use data classes, some leave classes closed by default. So, we decided to collect all best practices on using Kotlin with JPA in one blog post. This article has been read by almost 10K developers and takes second place in our chart.

We have also conducted a few polls on Twitter. Here are the most interesting facts and conclusions we made.

The Source of Truth for the Data Model

In this poll, we asked our community where they have the source of truth for their data model. 56% of developers manage their data model in the database and then synchronize DB tables with JPA entities, while 44% develop the data model as JPA entities and update the database in accordance with modifications in Java code.

By that time JPA Buddy already had tools to automate the generation of differential update scripts comparing JPA entities and the target database - much help for those who keep the source of truth in the codebase. However, more than a half couldn't benefit that much from JPA Buddy.

That made us set the highest priority for the reverse engineering feature and even reshape our views on how it should be designed. Before this poll, we had seen reverse engineering as a one-off operation: developers trigger it once at the project initial stage. The results of the poll showed that developers use it constantly, making changes in the database during the entire lifetime of the application. So, we decided to support the cherry-picking approach for reverse engineering to let users generate only missing mappings without regenerating the whole entity class.

Hope now JPA Buddy covers the requirements of both camps: entity first and table first followers!

Flyway vs Liquibase

Today JPA Buddy lets users automatically generate differential update scripts for both Liquibase and Flyway, however, in the initial release we offered only Liquibase support. To understand what priority should be assigned to the Flyway support feature we ran this poll:

It showed that Flyway has an advantage in the Java community. After analysis of comments under the tweet we can state the following:

  • People choose Liquibase mainly for the following features: changeset rollback, CSV data load, preconditions, labels and contexts.
  • The main advantage of Flyway is that it has a very straightforward concept and is easy to use.
  • Some still believe that it is out of their responsibility and DB update should be undertaken by DBAs in a way they prefer...

Right Mapping for SQL Timestamp/Datetime

While implementing the reverse engineering feature we needed to choose default mappings for various types provided by different RDBMS. Bet, you may easily guess what type caused endless debates. Of course, Timestamp/Datetime! So, we decided to ask the community what they think and posted this poll:

As you may see 63% voted for LocalDateTime. Thanks to Simon Martinelli and Corneil du Plessis who first noted that the right answer is not mentioned among the offered options! The one we were looking for was java.time.Instant!

Using Spring Data JPA, Hibernate or EclipseLink and code in IntelliJ IDEA? Make sure you are ultimately productive with the JPA Buddy plugin!

It will always give you a valuable hint and even generate the desired piece of code for you: JPA entities and Spring Data repositories, Liquibase changelogs and Flyway migrations, DTOs and MapStruct mappers and even more!

Plans for 2022

First of all, in 2022 a couple of features will become available only under commercial subscription. JPA Buddy is a self-invested project, however, during 2021 we managed to keep the results of our work completely free. Next year we need to establish a sustainable funding channel to be able to produce an even better product for all. We have chosen the freemium model keeping most of the features free, including all visual designers for entities, Spring Data repositories, SQL and Liquibase changelogs. Automatic differential scripts generation and reverse engineering (since it leaves the incubator) will cost $1.9 monthly for individual users. JPA Buddy remains free for students and academic use (teachers, students, classroom assistance) as well as training courses, coding schools and bootcamps. Also, we offer a 50% discount for universities, educational and non-profit organizations. We believe that the right tools save a lot of time and that a few dollars a month will pay off in a couple of days with JPA Buddy.

Secondly, we plan to finalize the reverse engineering feature to support not only cherry-picking, but also bulk operations. Ultimately, we would love to provide a feature to create a new application directly from the existing database, so it could generate all entities, repositories and even REST controllers for CRUD operations.

Third, we are going to introduce a new feature of smart hints, where you could see a different kind of advices to make your application better: tips for efficient mappings and data fetching optimizations.

Finally, we already have a lot of things to work on in our issue tracker. We are willing to prioritize these features in accordance with your feedback and bring them live one by one.

The JPA Buddy team wishes you a Merry Christmas and Happy New Year! We hope the next year will be even more productive. Hope, COVID will finally leave us in 2022 and we will be able to travel over the globe meeting our community offline, gathering new ideas to make software development even more joyful. We are happy to thank half a million developers who tried JPA Buddy in 2021 and say thank you twice to those who got in touch to report bugs or share recommendations and ideas.

Merry Christmas and Happy New Year!