Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ annotationProcessor 'org.hibernate.orm:hibernate-processor:7.0.0.Final'

=== Excluding classes from processing

There's three ways to limit the annotation processor to certain classes:
There are three ways to limit the annotation processor to certain classes:

1. A given repository may be excluded from processing simply by specifying `@Repository(provider="acme")` where `"acme"` is any string other than the empty string or a string equal, ignoring case, to `"Hibernate"`. This is the preferred solution when there are multiple Jakarta Data Providers available.
2. A package or type may be excluded by annotating it with the link:{doc-javadoc-url}org/hibernate/annotations/processing/Exclude.html[`@Exclude`] annotation from `org.hibernate.annotations.processing`.
Expand Down
10 changes: 5 additions & 5 deletions documentation/src/main/asciidoc/repositories/Repositories.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ Furthermore, if the parameter type is a list or array of the entity field type,
List<Book> books(String[] ibsn);
----

Or course, an automatic query method might have multiple parameters.
Of course, an automatic query method might have multiple parameters.

[source,java]
----
Expand Down Expand Up @@ -468,7 +468,7 @@ List<Book> booksByTitle(String pattern);
You might notice that:

- The `from` clause is not required in JDQL, and is inferred from the return type of the repository method.
- Since Jakarta Persistence 3.2, neither the `select` cause nor entity aliases (identification variables) are required in JPQL, finally standardizing a very old feature of HQL.
- Since Jakarta Persistence 3.2, neither the `select` clause nor entity aliases (identification variables) are required in JPQL, finally standardizing a very old feature of HQL.

This allows simple queries to be written in a very compact form.

Expand Down Expand Up @@ -499,10 +499,10 @@ The JPQL specification provides the `select new` construct for this.

[source,java]
----
@Query("select new AuthorBookSummary(b.isbn, a.ssn, a.name, b.title " +
@Query("select new AuthorBookSummary(b.isbn, a.ssn, a.name, b.title) " +
"from Author a join books b " +
"where title like :pattern")
List<AuthorBookSummary> summariesForTitle(String pattern);
List<AuthorBookSummary> summariesForTitle(@Pattern String pattern);
----

Note that the `from` clause is required here, since it's impossible to infer the queried entity type from the return type of the repository method.
Expand All @@ -515,7 +515,7 @@ Since this is quite verbose, Hibernate doesn't require the use of `select new`,
@Query("select isbn, ssn, name, title " +
"from Author join books " +
"where title like :pattern")
List<AuthorBookSummary> summariesForTitle(String pattern);
List<AuthorBookSummary> summariesForTitle(@Pattern String pattern);
----
====

Expand Down
Loading