From 24e44afd68cd3173881106f99405494aed41fc0d Mon Sep 17 00:00:00 2001 From: Gavin King Date: Wed, 21 May 2025 22:26:52 +0200 Subject: [PATCH] some updates to the Repositories guide --- .../main/asciidoc/repositories/Configuration.adoc | 2 +- .../src/main/asciidoc/repositories/Preface.adoc | 2 +- .../main/asciidoc/repositories/Repositories.adoc | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/documentation/src/main/asciidoc/repositories/Configuration.adoc b/documentation/src/main/asciidoc/repositories/Configuration.adoc index d41584ec463e..72161c9a5965 100644 --- a/documentation/src/main/asciidoc/repositories/Configuration.adoc +++ b/documentation/src/main/asciidoc/repositories/Configuration.adoc @@ -55,7 +55,7 @@ In Gradle, for example, you'll need to use `annotationProcessor`. [source,groovy] ---- -annotationProcessor 'org.hibernate.orm:hibernate-processor:7.0.0' +annotationProcessor 'org.hibernate.orm:hibernate-processor:7.0.0.Final' ---- === Excluding classes from processing diff --git a/documentation/src/main/asciidoc/repositories/Preface.adoc b/documentation/src/main/asciidoc/repositories/Preface.adoc index 0c2ee6d8b9f9..c47d97e4bfd5 100644 --- a/documentation/src/main/asciidoc/repositories/Preface.adoc +++ b/documentation/src/main/asciidoc/repositories/Preface.adoc @@ -16,7 +16,7 @@ On the other hand, the programming model for interacting with the database is qu Therefore, this document will show you a different way to use Hibernate. The coverage of Jakarta Data is intentionally inexhaustive. -If exhaustion is sought, this document should be read in conjunction with the specification, which we've worked hard to keep readable. +If exhaustion is sought, this document should be read in conjunction with https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0[the specification], which we've worked hard to keep readable. If you are unfamiliar with Hibernate, this document should be read in conjunction with: diff --git a/documentation/src/main/asciidoc/repositories/Repositories.adoc b/documentation/src/main/asciidoc/repositories/Repositories.adoc index cfc802f7eecd..d6d58cc8c4ba 100644 --- a/documentation/src/main/asciidoc/repositories/Repositories.adoc +++ b/documentation/src/main/asciidoc/repositories/Repositories.adoc @@ -49,7 +49,7 @@ public class Author { } ---- -For more information about mapping entities, see the link:{doc-introduction-url}#entities[Introduction to Hibernate 6]. +For more information about mapping entities, see the link:{doc-introduction-url}#entities[Short Guide to Hibernate 7]. [NOTE] ==== @@ -138,7 +138,7 @@ A _repository interface_ is an interface written by you, the application program The implementation of the repository interface is provided by a Jakarta Data provider, in our case, by Hibernate Data Repositories. The Jakarta Data specification does not say how this should work, but in Hibernate Data Repositories, the implementation is generated by an annotation processor. -In fact, you might already be using this annotation processor: it's just `HibernateProcessor` from the module which used to be called `hibernate-jpamodelgen`, and has now been renamed `hibernate-processor` in Hibernate 7. +In fact, you might already be using https://hibernate.org/orm/processor/[this annotation processor]: it's just `HibernateProcessor` from the module which used to be called `hibernate-jpamodelgen`, and has now been renamed `hibernate-processor` in Hibernate 7. [TIP] ==== @@ -147,7 +147,7 @@ If you're already using the JPA static metamodel in your project, you already ha If you don't, we'll see how to set it up in the <>. ==== -Of course, a Jakarta Data provider can't generate an implementation of any arbitrary method. +Unlike a language model, a Jakarta Data provider can't generate an implementation of any arbitrary method based only on vibes. Therefore, the methods of a repository interface must fall into one of the following categories: - <>, @@ -204,7 +204,7 @@ interface AuthorRepository } ---- -We won't see `BasicRepository` and `CrudRepository` again in this document, because they're not necessary, and because they implement the older, less-flexible way of doing things. +We won't see `BasicRepository` and `CrudRepository` again in this document, because they're not necessary, and because they implement the older, completely uncool way of doing things. Instead, our repositories will often group together operations dealing with several related entities, even when the entities don't have a single "root". This situation is _extremely_ common in relational data models. @@ -259,7 +259,11 @@ For that, we'll need to add a resource accessor method. === Resource accessor methods A resource accessor method is one which exposes access to an underlying implementation type. -Currently, Hibernate Data Repositories only supports one such type: `StatelessSession`. +Currently, Hibernate Data Repositories supports two such implementation types: + +1. `StatelessSession`, for the ordinary sort of repository we're talking about now, and +2. `Mutiny.StatelessSession`, for <>. + So a resource accessor method is just any abstract method which returns `StatelessSession`. The name of the method doesn't matter.