High-Performance Java Persistence Newsletter, Issue 41
Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Wouldn’t that be just awesome?
Well, Hypersistence Optimizer is that tool! And it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, or Play Framework.
So, enjoy spending your time on the things you love rather than fixing performance issues in your production system on a Saturday night!
Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java.
The pick of this edition is this article about the challenges of using Soft Deletes and what you should consider before adopting this technique in your software project. While Soft Deleting is a widespread technique, in reality, an audit logging solution is much more powerful, as it will allow you to track and revert any operation that was done mistakingly.
I wrote an article about the maximum number of database connections you could use and why the number is usually way shorter than you might think. This article will help you determine what’s the number of connections for which your database systems can provide the best throughput using the Universal Scalability Law.
I’ve been using Amazon Aurora for RevoGain, and I’m really impressed by its performance and simplicity. If you want to see how well it can scale, then check out these performance metrics that were recorded during Amazon Prime Day 2022. So, not only it’s easy to use, but it’s also scalable, making it a great choice for new projects.
Java has been providing a dedicated Money and Currency API for quite some time, but Hibernate does not currently offer built-in support for it. Luckily, you can now use the Hibernate Types project to persist
MonetaryAmount objects that contain both the money amount and the associated currency. Check out this article for more details.
I found this podcast with Roberta Arcoverde about StackOverflow architecture, development practices, and why using a monolith is fine when the team is small enough for the application evolution to be done rapidly because of the solid software engineering practices embraced by the team.
I uploaded a new video on YouTube about SQL Recursive CTE queries.
This video is part of my High-Performance SQL video course, so if you like this episode, you are going to love the video course.
Here are the best tweets I posted since the last newsletter:
When I started learning Java in 2002, many people were saying that Java is slow and can never compete with C or C++.— Vlad Mihalcea (@vlad_mihalcea) July 30, 2022
20 years later, all High-Frequency Trading companies I know use Java instead of C/C++.https://t.co/45NjrMnyWW pic.twitter.com/7YOZ3rZeTk
Unfortunately, developers don't always consider the long-term financial implications of software development techniques and architecture patterns they are adopting.— Vlad Mihalcea (@vlad_mihalcea) July 23, 2022
Writing tests doesn't reduce project velocity. Skipping tests gives a false impression that you are doing "progress".— Vlad Mihalcea (@vlad_mihalcea) July 26, 2022
Without proving your work, velocity is meaningless, as it doesn't measure the actual progress, but the level of hope.
My HP printer is 15 years old and works like a charm.— Vlad Mihalcea (@vlad_mihalcea) July 31, 2022
And, it's been working like that on Windows XP, 7, and 11.
That's how hardware and software should be built as well. pic.twitter.com/bO3SOI3cWJ
Software development is the business of creating technical debt.— Vlad Mihalcea (@vlad_mihalcea) August 1, 2022
I managed to release the 2.17 of the Hibernate Types project, which provides two additional that you are going to love using:
- a built-in
HibernateRepositorythat you can use as the base class of all your Spring Data JPA repositories, as explained in this article
MonetaryAmountTypethat will help you save Java Money and Currency
MySQL 8.0.30 has been released, offering various fixes and improvements, like the new Generated Invisible Primary Keys (GIPKs) feature that aims to address some issues caused by tables with no primary key.
The MySQL JDBC Drivers released the 8.0.30 version as well, and from the release notes, we learned that we could actually use the
rewriteBatchedStatements configuration property with JDBC
PreparedStatement. Traditionally, this setting has been used only for plain
Statement batching only. So, I plan on running some tests and writing an article about this change.
Hibernate ORM has released several new versions that address a performance improvement for the bytecode enhancement dirty checking mechanism:
Get in touch with my latest articles!
The following StackOverflow answers have been trending since the last newsletter episode:
- Hibernate auto key generation with MySQL and Oracle
TransactionAttributeType.NOT_SUPPORTEDmake sense for retrieving entities?
- How to register a custom
IdentifierGeneratorin Hibernate JPA EntityManager?
- How to get the Oracle transaction id of the transaction that caused a trigger
- How can I batch the audit table inserts using the Hibernate Envers