21 October 2021

What’s new in JPA Buddy 5

JPA Buddy has learned some new tricks! Let’s take a look at what features were rolled out in the latest major release: reverse engineering, new entity designer capabilities, improved settings, more code generation tools and other useful things.

Reverse Engineering

JPA Buddy 5.0 introduces reverse engineering! Granularly pick tables and fields from your database and get them as JPA entities:

Pick the field types during attribute preview or change the default mappings in Settings -> Tools -> JPA Buddy -> Reverse Engineering:

Naming Template Settings

External DBs may have unusual naming conventions for tables, columns etc., which you have to follow when mapping them to JPA entities. This is why JPA Buddy offers flexible configuration of naming templates, which are automatically applied to new entities and attributes.

These settings were available before, but you had to specify the templates by hand. Now they can be configured via an easy-to-use table:

New Entity Designer Features

In some cases, using @ElementCollection instead of @OneToMany can be a valid solution. However, be aware that it can affect the performance, Thorben Janssen gives a great explanation why:

https://thorben-janssen.com/hibernate-tips-elementcollection/

JPA Buddy can now help you to add @ElementCollection to your entities, once you’re sure it fits your case:

Also, the support for @UniqueConstraint generation has been added as well:

Improved Error Dialogs for Flyway/Liquibase Script Generator

It’s frustrating to get errors, it’s even more frustrating when there is no obvious way to fix them. That’s why we added actionable items to the Flyway/Liquibase Script Generator errors:

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!

Conclusion

This is just some of the features and improvements that were added in the 5.0 version and subsequent minor releases. Find the full list in our issue tracker. Share your feedback and ideas in our Discord channel and follow us on Twitter to get the latest news about JPA Buddy along with useful JPA tips!