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: documentation/src/main/asciidoc/repositories/Reactive.adoc
+10-2
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,8 @@ interface Library {
49
49
50
50
It's _not_ possible to mix blocking and non-blocking operations in the same repository interface.
51
51
52
+
IMPORTANT: Depending on how you're managing the stateless session, you might need to declare the resource accessor method with the type `Uni<Mutiny.StatelessSession>`.
53
+
52
54
=== Obtaining a reactive repository
53
55
54
56
To make use of our reactive repository, we'll need to bootstrap Hibernate Reactive and obtain a `Mutiny.SessionFactory`.
@@ -61,7 +63,9 @@ Mutiny.SessionFactory factory =
61
63
.unwrap(Mutiny.SessionFactory.class);
62
64
----
63
65
64
-
Please refer to the documentation for Hibernate Reactive for more information on this topic.
66
+
Please refer to the https://hibernate.org/reactive/documentation/[documentation for Hibernate Reactive] for more information on this topic.
67
+
68
+
TIP: In Quarkus, this step is unnecessary, and you can let Quarkus manage and inject the reactive `SessionFactory`.
65
69
66
70
Once we have the `SessionFactory`, we can easily obtain a `Mutiny.StatelessSession`, and use it to instantiate our repository:
TIP: In Quarkus, all this is unnecessary, and you can directly inject the `Library`.
80
+
TIP: An even better approach is to make a `@RequestScoped` instance of `Mutiny.StatelessSession` or `Uni<Mutiny.StatelessSession>` available for injection by CDI.
81
+
Then the `Library` repository itself may be directly injected, and you won't have to worry about managing the stateless session in application program code.
82
+
This is a little bit tricky to get working perfectly, so hopefully by the time you're reading this, there will already be a built-in implementation in Quarkus.
83
+
84
+
// TIP: In Quarkus, all this is unnecessary, and you can directly inject the `Library`.
0 commit comments