Skip to content

Commit 4888226

Browse files
committed
Sync documentation of main branch
1 parent c692d58 commit 4888226

8 files changed

+160
-44
lines changed

_generated-doc/main/config/quarkus-all-config.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12033,7 +12033,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_SERVICE_NAME+++`
1203312033
endif::add-copy-button-to-env-var[]
1203412034
--
1203512035
|string
12036-
|`quarkus`
12036+
|`keycloak`
1203712037

1203812038
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path[`quarkus.keycloak.devservices.realm-path`]##
1203912039
ifdef::add-copy-button-to-config-props[]
@@ -12364,7 +12364,7 @@ endif::add-copy-button-to-config-props[]
1236412364
--
1236512365
Memory limit for Keycloak container, up to `Long.MAX_VALUE` bytes.
1236612366

12367-
If not specified, 750MiB is the default memory limit.
12367+
If not specified, 1250MiB is the default memory limit.
1236812368

1236912369

1237012370
ifdef::add-copy-button-to-env-var[]
@@ -12375,7 +12375,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_CONTAINER_MEMORY_LIMIT+++
1237512375
endif::add-copy-button-to-env-var[]
1237612376
--
1237712377
|MemorySize link:#memory-size-note-anchor-all-config[icon:question-circle[title=More information about the MemorySize format]]
12378-
|`750M`
12378+
|`1250M`
1237912379

1238012380
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout[`quarkus.keycloak.devservices.web-client-timeout`]##
1238112381
ifdef::add-copy-button-to-config-props[]
@@ -67046,9 +67046,7 @@ endif::add-copy-button-to-config-props[]
6704667046

6704767047
[.description]
6704867048
--
67049-
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`. In this case, before starting a container, Dev Services for looks for a container with the `quarkus-dev-service` label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the `quarkus-dev-service` label set to the specified value.
67050-
67051-
This property is used when you need multiple shared containers.
67049+
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`.
6705267050

6705367051

6705467052
ifdef::add-copy-button-to-env-var[]
@@ -67059,7 +67057,7 @@ Environment variable: `+++QUARKUS_OBSERVABILITY_LGTM_SERVICE_NAME+++`
6705967057
endif::add-copy-button-to-env-var[]
6706067058
--
6706167059
|string
67062-
|`quarkus`
67060+
|`lgtm`
6706367061

6706467062
a|icon:lock[title=Fixed at build time] [[quarkus-observability-devservices_quarkus-observability-lgtm-username]] [.property-path]##link:#quarkus-observability-devservices_quarkus-observability-lgtm-username[`quarkus.observability.lgtm.username`]##
6706567063
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-devservices-keycloak.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_SERVICE_NAME+++`
110110
endif::add-copy-button-to-env-var[]
111111
--
112112
|string
113-
|`quarkus`
113+
|`keycloak`
114114

115115
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path[`quarkus.keycloak.devservices.realm-path`]##
116116
ifdef::add-copy-button-to-config-props[]
@@ -441,7 +441,7 @@ endif::add-copy-button-to-config-props[]
441441
--
442442
Memory limit for Keycloak container, up to `Long.MAX_VALUE` bytes.
443443

444-
If not specified, 750MiB is the default memory limit.
444+
If not specified, 1250MiB is the default memory limit.
445445

446446

447447
ifdef::add-copy-button-to-env-var[]
@@ -452,7 +452,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_CONTAINER_MEMORY_LIMIT+++
452452
endif::add-copy-button-to-env-var[]
453453
--
454454
|MemorySize link:#memory-size-note-anchor-quarkus-devservices-keycloak_quarkus-keycloak[icon:question-circle[title=More information about the MemorySize format]]
455-
|`750M`
455+
|`1250M`
456456

457457
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout[`quarkus.keycloak.devservices.web-client-timeout`]##
458458
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-devservices-keycloak_quarkus.keycloak.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_SERVICE_NAME+++`
110110
endif::add-copy-button-to-env-var[]
111111
--
112112
|string
113-
|`quarkus`
113+
|`keycloak`
114114

115115
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-realm-path[`quarkus.keycloak.devservices.realm-path`]##
116116
ifdef::add-copy-button-to-config-props[]
@@ -441,7 +441,7 @@ endif::add-copy-button-to-config-props[]
441441
--
442442
Memory limit for Keycloak container, up to `Long.MAX_VALUE` bytes.
443443

444-
If not specified, 750MiB is the default memory limit.
444+
If not specified, 1250MiB is the default memory limit.
445445

446446

447447
ifdef::add-copy-button-to-env-var[]
@@ -452,7 +452,7 @@ Environment variable: `+++QUARKUS_KEYCLOAK_DEVSERVICES_CONTAINER_MEMORY_LIMIT+++
452452
endif::add-copy-button-to-env-var[]
453453
--
454454
|MemorySize link:#memory-size-note-anchor-quarkus-devservices-keycloak_quarkus-keycloak[icon:question-circle[title=More information about the MemorySize format]]
455-
|`750M`
455+
|`1250M`
456456

457457
a|icon:lock[title=Fixed at build time] [[quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout]] [.property-path]##link:#quarkus-devservices-keycloak_quarkus-keycloak-devservices-web-client-timeout[`quarkus.keycloak.devservices.web-client-timeout`]##
458458
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-observability-devservices.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ endif::add-copy-button-to-config-props[]
6767

6868
[.description]
6969
--
70-
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`. In this case, before starting a container, Dev Services for looks for a container with the `quarkus-dev-service` label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the `quarkus-dev-service` label set to the specified value.
71-
72-
This property is used when you need multiple shared containers.
70+
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`.
7371

7472

7573
ifdef::add-copy-button-to-env-var[]
@@ -80,7 +78,7 @@ Environment variable: `+++QUARKUS_OBSERVABILITY_LGTM_SERVICE_NAME+++`
8078
endif::add-copy-button-to-env-var[]
8179
--
8280
|string
83-
|`quarkus`
81+
|`lgtm`
8482

8583
a|icon:lock[title=Fixed at build time] [[quarkus-observability-devservices_quarkus-observability-lgtm-username]] [.property-path]##link:#quarkus-observability-devservices_quarkus-observability-lgtm-username[`quarkus.observability.lgtm.username`]##
8684
ifdef::add-copy-button-to-config-props[]

_generated-doc/main/config/quarkus-observability-devservices_quarkus.observability.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ endif::add-copy-button-to-config-props[]
6767

6868
[.description]
6969
--
70-
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`. In this case, before starting a container, Dev Services for looks for a container with the `quarkus-dev-service` label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the `quarkus-dev-service` label set to the specified value.
71-
72-
This property is used when you need multiple shared containers.
70+
The value of the `quarkus-dev-service` label attached to the started container. This property is used when `shared` is set to `true`.
7371

7472

7573
ifdef::add-copy-button-to-env-var[]
@@ -80,7 +78,7 @@ Environment variable: `+++QUARKUS_OBSERVABILITY_LGTM_SERVICE_NAME+++`
8078
endif::add-copy-button-to-env-var[]
8179
--
8280
|string
83-
|`quarkus`
81+
|`lgtm`
8482

8583
a|icon:lock[title=Fixed at build time] [[quarkus-observability-devservices_quarkus-observability-lgtm-username]] [.property-path]##link:#quarkus-observability-devservices_quarkus-observability-lgtm-username[`quarkus.observability.lgtm.username`]##
8684
ifdef::add-copy-button-to-config-props[]

_versions/main/guides/_attributes.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
:hibernate-orm-version-major-minor: 6.6
3131
:hibernate-search-version-major-minor: 7.2
3232
:hibernate-validator-version-major-minor: 8.0
33+
:jakarta-persistence-version-major-minor: 3.1
3334
// .
3435
:quarkus-home-url: https://quarkus.io
3536
:quarkus-org-url: https://github.com/quarkusio
@@ -56,6 +57,7 @@
5657
:hibernate-orm-dialect-docs-url: https://docs.jboss.org/hibernate/orm/{hibernate-orm-version-major-minor}/dialect/dialect.html
5758
:hibernate-search-docs-url: https://docs.jboss.org/hibernate/search/{hibernate-search-version-major-minor}/reference/en-US/html_single/
5859
:hibernate-validator-docs-url: https://docs.jboss.org/hibernate/validator/{hibernate-validator-version-major-minor}/reference/en-US/html_single/
60+
:jakarta-persistence-spec-url: https://jakarta.ee/specifications/persistence/{jakarta-persistence-version-major-minor}/jakarta-persistence-spec-{jakarta-persistence-version-major-minor}#a6072
5961
// .
6062
:amazon-services-guide: https://docs.quarkiverse.io/quarkus-amazon-services/dev/index.html
6163
:config-consul-guide: https://docs.quarkiverse.io/quarkus-config-extensions/dev/consul.html

_versions/main/guides/hibernate-orm.adoc

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,3 +1646,134 @@ try {
16461646
Since Quarkus has built-in exception mappers for `jakarta.validation.ConstraintViolationException`,
16471647
explicitly handling these exceptions might be redundant. See the xref:validation.adoc#rest-end-point-validation[REST end point validation]
16481648
section of the Hibernate Validator guide for more details.
1649+
1650+
[[jakarta-data]]
1651+
== Static metamodel and Jakarta Data
1652+
1653+
Both static metamodel and Jakarta Data capabilities of Hibernate ORM are available in Quarkus
1654+
through the `hibernate-jpamodelgen` annotation processor. Since it is an annotation processor,
1655+
you must configure the annotation processor in your build tool:
1656+
1657+
[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
1658+
.pom.xml
1659+
----
1660+
<plugin>
1661+
<artifactId>maven-compiler-plugin</artifactId>
1662+
<configuration>
1663+
<annotationProcessorPaths>
1664+
<path>
1665+
<groupId>org.hibernate.orm</groupId>
1666+
<artifactId>hibernate-jpamodelgen</artifactId>
1667+
<!-- Note, no artifact version is required, it's managed by Quarkus. -->
1668+
</path>
1669+
<!-- other processors that may be required by your app -->
1670+
</annotationProcessorPaths>
1671+
<!-- Other compiler plugin configuration options -->
1672+
</configuration>
1673+
</plugin>
1674+
----
1675+
1676+
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
1677+
.build.gradle
1678+
----
1679+
// Enforce the version management of your annotation processor dependencies,
1680+
// so that there's no need to define an explicit version of the hibernate-jpamodelgen
1681+
annotationProcessor enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
1682+
annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen'
1683+
----
1684+
1685+
=== Static metamodel
1686+
1687+
The generated static metamodel allows for building queries in a type-safe manner.
1688+
Let's consider having a simple entity:
1689+
1690+
[source,java]
1691+
----
1692+
@Entity
1693+
public class MyEntity {
1694+
@Id
1695+
@GeneratedValue
1696+
public Integer id;
1697+
1698+
@Column(unique = true)
1699+
public String name;
1700+
}
1701+
----
1702+
1703+
A query created with the help of static metamodel may look as:
1704+
1705+
[source,java]
1706+
----
1707+
var builder = session.getCriteriaBuilder();
1708+
var criteria = builder.createQuery(MyEntity.class);
1709+
var e = criteria.from(MyEntity_.class);
1710+
criteria.where(e.get(MyEntity_.name).equalTo(name));
1711+
var query = session.createQuery(criteria);
1712+
var result = query.list();
1713+
----
1714+
1715+
For a more detailed overview of static metamodel, please refer to the link:{jakarta-persistence-spec-url}#a6072[Jakarta Persistence specification].
1716+
1717+
=== Jakarta Data
1718+
1719+
Jakarta Data requires, besides having the `hibernate-jpamodelgen` annotation processor in place, one extra dependency to be added:
1720+
1721+
[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
1722+
.pom.xml
1723+
----
1724+
<dependency>
1725+
<groupId>jakarta.data</groupId>
1726+
<artifactId>jakarta.data-api</artifactId>
1727+
</dependency>
1728+
----
1729+
1730+
[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"]
1731+
.build.gradle
1732+
----
1733+
implementation 'jakarta.data:jakarta.data-api'
1734+
----
1735+
1736+
With this dependency, and the annotation processor in place you could simply create your repositories as follows:
1737+
1738+
[source,java]
1739+
----
1740+
@Repository
1741+
public interface MyRepository extends CrudRepository<MyEntity, Integer> { // <1>
1742+
1743+
@Query("select e from MyEntity e where e.name like :name") // <2>
1744+
List<MyEntity> findByName(String name);
1745+
1746+
@Delete // <3>
1747+
void delete(String name);
1748+
1749+
}
1750+
----
1751+
1. To skip the boilerplate definition of CRUD operations,
1752+
we can use one of the available interfaces (e.g. `CrudRepository` or `BasicRepository`).
1753+
2. Adding custom queries with parameters is as easy as providing your query string to the `@Query` annotation.
1754+
3. If the basic CRUD operations from the Jakarta Data interfaces are not enough,
1755+
we can always add a custom one, in this case a delete operation that removes `MyEntity`s by name.
1756+
1757+
And then the repository can be used as any other bean:
1758+
1759+
[source,java]
1760+
----
1761+
public class MyEntityResource {
1762+
1763+
@Inject
1764+
MyRepository repository;
1765+
1766+
@POST
1767+
@Transactional
1768+
public void create(MyEntity entity) {
1769+
repository.insert(entity);
1770+
}
1771+
1772+
// ...
1773+
1774+
}
1775+
----
1776+
1777+
Please refer to the corresponding https://hibernate.org/repositories/[Hibernate Data Repositories]
1778+
and https://jakarta.ee/specifications/data/1.0/jakarta-data-1.0[Jakarta Data]
1779+
guides to learn what else they have to offer.

_versions/main/guides/security-customization.adoc

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,52 +248,45 @@ The solution is to activate the request context, the following example shows how
248248

249249
[source,java]
250250
----
251+
import jakarta.enterprise.context.ApplicationScoped;
252+
import jakarta.inject.Inject;
253+
251254
import io.quarkus.security.identity.AuthenticationRequestContext;
252255
import io.quarkus.security.identity.SecurityIdentity;
253256
import io.quarkus.security.identity.SecurityIdentityAugmentor;
254257
import io.smallrye.mutiny.Uni;
255258
256-
import jakarta.enterprise.context.ApplicationScoped;
257-
import jakarta.enterprise.inject.Instance;
258-
import jakarta.inject.Inject;
259-
260259
@ApplicationScoped
261260
public class RolesAugmentor implements SecurityIdentityAugmentor {
262261
263262
@Inject
264-
Instance<SecurityIdentitySupplier> identitySupplierInstance;
263+
UserEntityAugmentor userEntityAugmentor;
265264
266265
@Override
267266
public Uni<SecurityIdentity> augment(SecurityIdentity identity, AuthenticationRequestContext context) {
268-
if(identity.isAnonymous()) {
267+
if (identity.isAnonymous()) {
269268
return Uni.createFrom().item(identity);
270269
}
271270
272271
// Hibernate ORM is blocking
273-
SecurityIdentitySupplier identitySupplier = identitySupplierInstance.get();
274-
identitySupplier.setIdentity(identity);
275-
return context.runBlocking(identitySupplier);
272+
return context.runBlocking(() -> userEntityAugmentor.augment(identity));
276273
}
277274
}
278275
----
279276

280277
[source,java]
281278
----
282-
import io.quarkus.security.identity.SecurityIdentity;
283-
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
284-
285-
import jakarta.enterprise.context.Dependent;
279+
import jakarta.enterprise.context.ApplicationScoped;
286280
import jakarta.enterprise.context.control.ActivateRequestContext;
287-
import java.util.function.Supplier;
288281
289-
@Dependent
290-
class SecurityIdentitySupplier implements Supplier<SecurityIdentity> {
282+
import io.quarkus.security.identity.SecurityIdentity;
283+
import io.quarkus.security.runtime.QuarkusSecurityIdentity;
291284
292-
private SecurityIdentity identity;
285+
@ApplicationScoped
286+
class UserEntityAugmentor {
293287
294-
@Override
295288
@ActivateRequestContext
296-
public SecurityIdentity get() {
289+
public SecurityIdentity augment(SecurityIdentity identity) {
297290
QuarkusSecurityIdentity.Builder builder = QuarkusSecurityIdentity.builder(identity);
298291
String user = identity.getPrincipal().getName();
299292
@@ -303,10 +296,6 @@ class SecurityIdentitySupplier implements Supplier<SecurityIdentity> {
303296
304297
return builder.build();
305298
}
306-
307-
public void setIdentity(SecurityIdentity identity) {
308-
this.identity = identity;
309-
}
310299
}
311300
----
312301

0 commit comments

Comments
 (0)