Bio
Gavin King is a Distinguished Engineer at Red Hat. He's the creator of Hibernate, a popular persistence solution for Java and of the Ceylon programming language. He contributed to the Java Community Process as JBoss and then Red Hat representative for the EJB and JPA specifications and as spec lead and author of the CDI specification. He's currently a major contributor to the design of Jakarta Data and Jakarta Persistence. He lives in Barcelona with his wife and three daughters. His active interests include theoretical physics and quantum technologies.
Tags
Authors
I think it’s fair to say that Jakarta Persistence has too many options for mapping collections and to-many associations. Way back when we wrote JPA 1.0, I argued against adding so many things, on the grounds that a lot of these options tend to lead users down the wrong path. But the things I wasn’t keen on were ultimately added in JPA 2.0, and I can’t really say this was a bad decision, since all these options are things users ask for.
That said, I’m going to begin by reiterating what I’ve said many times before:
[ ... ]
Today someone asked us to add some documentation explaining how to deal with addition of elements to very large collections. I’m not sure if this is a topic I really want to talk about in the documentation, but it’s definitely worth a blog.
We’re now seeing a lot of interest in Jakarta Data, along with very positive reactions from the people who’ve already tried it out.
I’m afraid I missed the news that Hibernate 6.6 is now available in Quarkus, and so I’ve been slow of the mark in letting everyone know that Hibernate Data Repositories, our implementation of Jakarta Data, is now fully integrated with Quarkus. 🎉🎉
To start writing repositories, all you need to add is:
Since the JSR-220 Expert Group introduced annotation-based dependency injection and the Java Persistence API as part of Java EE 1.5, it’s been possible to inject an EntityManager
or EntityManagerFactory
into most Java EE components using the dedicated @PersistenceContext
and @PersistenceUnit
annotations respectively.
Later, my JSR-299 Expert Group introduced a completely new approach to dependency injection, which ultimately came to be named Contexts and Dependency Injection for Java. Initially very controversial, CDI has over time become central to the Java EE platform—oops, I mean, Jakarta EE—and other technologies have adopted CDI, now in its sixth revision, as the base-level component model.
But back in CDI 1.0, I needed a way to bridge the gap between @PersistenceContext
and the @Inject
annotation supported by CDI.
And with CDI itself mired in FUD, I wasn’t exactly in a very strong political position to go asking the EE platform group to redefine their, at the time, pretty much brand-new dependency injection annotations in terms of the crazy new direction we were taking with CDI.
I had so many interesting new things to talk about in the summary of Jakarta Persistence 3.2 that I forgot to mention an important thing we’re taking away.
Jakarta Data is a new specification for persistence in Java, scheduled for release as part of the EE 11 platform. In a previous post I introduced the basic features of a Jakarta Data repository, with a strong emphasis on how Jakarta Data provides compile-time type safety, enabling static analysis performed by an annotation processor.
This involved moving some information that used to be expressed in procedural code into:
-
annotations like
@Query
and@Find
, and -
the names and types of repository method parameters.
Today we’re going to talk about some more dynamic features of Jakarta Data. You might anticipate that these would come with a loss of type safety, but we’ve found a way to avoid that. The essential ingredient is a static metamodel.
Today we’re excited to announce that Hibernate is moving to the Commonhaus Foundation. For the last 20 years, development of Hibernate has been funded and sponsored by JBoss, and then by Red Hat. This support will continue just as before, since Hibernate remains a critical component of JBoss EAP, WildFly, and Quarkus, but the project itself will now be hosted on neutral ground.
Cross-posted from Substack.
One of the most important experiences of my career was working with Linda DeMichiel from Sun, Mike Keith from TopLink, Evan Ireland from Sybase, and others, to design and write the first version of the Java Persistence specification.
Today this technology enjoys broad acceptance, even among former critics. But in recent years, despite a name change to Jakarta Persistence, the spec has not evolved rapidly. Not until now, that is. Over the last year or so, Lukas Jungmann from Oracle and I have been working rather hard to bring you the biggest release of Persistence in a long time.
This post will concentrate on new features we’ve added to Jakarta Persistence. It’s worth mentioning that quite a lot of work has gone into clarifying the semantics of existing features, and rewriting certain sections of the spec for clarity and readability. This is an ongoing effort. The spec is more than 500 pages in length; rewriting such text without accidentally changing its meaning is a slow and painstaking process.
In a previous post I talked about Jakarta Data. Alignment of the two specifications has been a further priority.
Cross-posted from Substack.
Jakarta Data is a new specification for persistence in Java, scheduled for release as part of the EE 11 platform. Whereas Jakarta Persistence provides a mature and extremely feature-rich foundation for object/relational mapping solutions like Hibernate, Jakarta Data aims to offer a somewhat simplified programming model, but one which is also suitable for use with non-relational databases.
Hibernate Reactive 1.0.0.Final is the first production-ready release of Hibernate Reactive, the only object-relational mapping solution that supports non-blocking database drivers and a reactive style of interaction with the database.
Hibernate Reactive now supports PostgreSQL, MySQL, MariaDB, Db2, SQL Server, and CockroachDB, and features almost all the functionality of the original Hibernate ORM. Under the hood, Hibernate Reactive uses the Vert.x non-blocking SQL client libraries.
Testing by the Hibernate team shows that use of Hibernate Reactive can, in at least some circumstances, significantly improve performance in situations of high database server load, compared to the use of traditional ORM over JDBC. (However, we must caution that a reactive system isn’t faster than a non-reactive program all or even most of the time!)