You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _versions/main/guides/hibernate-orm.adoc
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1008,6 +1008,7 @@ as it will also clone some enhancement-specific fields that are specific to the
1008
1008
This limitation might be removed in the future.
1009
1009
====
1010
1010
1011
+
[[automatic-integration]]
1011
1012
=== Automatic integration
1012
1013
1013
1014
Transaction Manager integration::
@@ -1265,6 +1266,9 @@ With this approach, all datasources used by the same persistence unit
1265
1266
are assumed to point to a database of the same vendor (same `db-kind`) and version.
1266
1267
1267
1268
Mismatches will not be detected, and may result in unpredictable behavior.
1269
+
1270
+
The list of datasources is defined at build time, so with this approach the **list** of tenants is **fixed at build time**.
1271
+
If the list of tenants needs to change at runtime, you must <<programmatically-resolving-tenants-connections,resolve the tenant connections programmatically>>.
1268
1272
====
1269
1273
1270
1274
[source,properties]
@@ -1367,6 +1371,61 @@ and annotating it with `@PersistenceUnitExtension` (or `@PersistenceUnitExtensio
1367
1371
will replace the current Quarkus default implementation `io.quarkus.hibernate.orm.runtime.tenant.DataSourceTenantConnectionResolver`.
1368
1372
Your custom connection resolver would allow for example to read tenant information from a database and create a connection per tenant at runtime based on it.
1369
1373
1374
+
[CAUTION]
1375
+
====
1376
+
<<automatic-integration,Automatic integrations>> will **not** work with programmatically-created `ConnectionProvider`.
1377
+
This implies all these integrations, including those from other Quarkus modules (e.g. xref:smallrye-health.adoc[SmallRye Health]) must be done manually.
1378
+
====
1379
+
1380
+
Here is an implementation example of a `TenantConnectionResolver` implementation using standard Quarkus technologies – Agroal for pooling and Narayana for transactions:
1381
+
1382
+
[source,java]
1383
+
----
1384
+
@ApplicationScoped
1385
+
@PersistenceUnitExtension
1386
+
public class ExampleTenantConnectionResolver implements TenantConnectionResolver {
1387
+
1388
+
private final jakarta.transaction.TransactionManager transactionManager;
1389
+
private final TransactionSynchronizationRegistry transactionSynchronizationRegistry;
Copy file name to clipboardExpand all lines: _versions/main/guides/rest.adoc
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1627,6 +1627,20 @@ public User userPrivate() {
1627
1627
When the result of the `userPublic` method is serialized, the `id` field will not be contained in the response as the `Public` view does not include it.
1628
1628
The result of `userPrivate` however will include the `id` as expected when serialized.
1629
1629
1630
+
`@JsonView` is also supported for deserializing the request body. So for example in the following code:
1631
+
1632
+
[source,java]
1633
+
----
1634
+
@POST
1635
+
@Produces(MediaType.APPLICATION_JSON)
1636
+
@Consumes(MediaType.APPLICATION_JSON)
1637
+
public RestResponse<User> create(@JsonView(Views.Public.class) User user) {
1638
+
return RestResponse.status(CREATED, user);
1639
+
}
1640
+
----
1641
+
1642
+
inside the `create` method, `user` would only contain the value of `name` while `id` would always be `null` (regardless if the JSON request contained it)
1643
+
1630
1644
===== Reflection-free Jackson serialization and deserialization
1631
1645
1632
1646
By default, Jackson uses reflection to convert objects to and from JSON.
0 commit comments