We're excited to announce the spring release of JPA Buddy! The new version includes several improvements. Here are some of them:
- Ability to specify a parent entity during reverse engineering.
- Full ModelMapper support.
- Improved "Extract to MappedSuperclass" action.
- Enhanced multi-module projects support.
- Numerous stability improvements and bug-fixes.
And that's just a small portion of what's included in this release. Check out this article to learn about all the enhancements!
Improved Entity Creation from the Database
Creating entities from database tables is undoubtedly one of the favorite features among users, and we continuously strive to enhance it further. Now, during the entity creation process, you have the option to specify the parent class for an entity! Devoted fans may recall that this functionality was previously offered in JPA Buddy:
However, after a significant improvement (the addition of the ability to create multiple entities from the database), it was temporarily removed. But now, we are not only reintroducing it but also making it even better! The latest JPA Buddy version can analyze entities for identical columns, apply
@AttributeOverride when needed, and even alert you if certain inherited attributes lack corresponding columns in the database!
Support for Multi-Module Projects
For developers working on monolithic applications, they may not pay much attention to this improvement, but it will be greatly appreciated by microservices developers. As you already know, JPA Buddy analyses the project for specific dependencies and enables corresponding features. This approach helps developers avoid distractions caused by currently unnecessary functions.
In this release, the analysis process for specific dependencies has become even more intelligent. Now, it examines individual modules within a project in case there are multiple modules. Depending on the presence of the required dependencies in a module, certain features are activated.
Full ModelMapper Support
The two most widely used tools for mapping DTOs to entities are MapStruct and ModelMapper. JPA Buddy has been providing support for MapStruct for a while, including:
- Generating mappers and corresponding methods.
- Providing code scaffolding for mapping a single entity or a collection of entities to DTOs and vice versa, with the help of postfix autocompletion.
- Enabling on-the-fly injection of the MapStruct bean into the relevant class.
And now, JPA Buddy can perform all the above for ModelMapper as well!
Seamless Integration with IntelliJ IDEA Ultimate for Reverse Engineering
One of the frequently asked questions in our Discord channel was something like, "I can't see tables in the “JPA entities from database” wizard" To help resolve this issue, we always asked users which version of IntelliJ IDEA they were using: Community or Ultimate. If they were using Ultimate, they often mentioned that could see tables in the "Database" panel but not in the JPA Buddy wizard.
This difference in behavior is because JPA Buddy used JDBC to read database information, while IntelliJ IDEA Ultimate utilizes its proprietary library. The capabilities of IntelliJ IDEA Ultimate for interacting with the database deserve recognition. You can even omit specifying the database or schema you need and still view the relevant information in the "Database" panel. However, the same cannot be said for the JDBC driver. When using it, you need to specify the database and, in certain cases, even the schema to establish a connection. These limitations were the cause of the disparities in displaying database information between the IntelliJ IDEA panel and the JPA Buddy window.
Starting from this release, users of IntelliJ IDEA Ultimate will have a smoother experience, and they won't encounter an inconsistency between the "Database" panel and the JPA Buddy wizard. The most amazing part of this improvement is that JPA Buddy can now utilize all the connection settings specified within the IntelliJ IDEA Ultimate interface.
Enhanced "Extract to MappedSuperclass" Action
The "Extract to MappedSuperclass" feature has become even better! Now, with JPA Buddy, you can extract both attributes and methods into a MappedSuperclass. It's important to notice that the selected methods will be checked to see if they use any class fields. If you accidentally forget to extract a field used in a method, JPA Buddy will remind you.
Coding Assistance for Adding Entity Fields to DTO
We are continuously enhancing coding assistance features. With the latest update, when you're working on a DTO associated with an entity, you can simply start typing the name of a field that doesn't exist in the opened DTO, and JPA Buddy will automatically complete it for you. The best part is that it even works with associations! See how much simpler it is to manually write code for DTOs now:
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!
This release is truly feature-packed, and this article only touches on a portion of what has been implemented. For example, we can mention the support for the
@Comment annotation in reverse engineering and migration script generation, the ability to define templates for Liquibase changesets or the support for the
@SuperBuilder annotation from Lombok. However, including all of them would make this article even longer. If you are interested in reviewing all features, improvements, and bugfixes, check out all of them on our YouTrack (75+ resolved issues).