[Docs] Additional datasources support (#42655)

* [Docs] Additional datasources support

Closes #40388

Closes #42263

Co-authored-by: Václav Muzikář <vaclav@muzikari.cz>
Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Rename namedKey to wildcardKey in the code

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Clarify the defaults for DB kind

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Be more clear about the Named key reference in guide

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

* Vasek's review

Signed-off-by: Martin Bartoš <mabartos@redhat.com>

---------

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
Co-authored-by: Václav Muzikář <vaclav@muzikari.cz>
This commit is contained in:
Martin Bartoš
2025-09-27 10:45:12 +02:00
committed by GitHub
parent 6e851ce80e
commit f53e5ebdac
32 changed files with 848 additions and 660 deletions

View File

@@ -12,6 +12,7 @@ include::topics/events.adoc[]
include::topics/saml-role-mappings-spi.adoc[]
endif::[]
include::topics/user-storage.adoc[]
include::topics/user-storage/entity-manager.adoc[]
include::topics/user-storage/provider-interfaces.adoc[]
include::topics/user-storage/provider-capability-interfaces.adoc[]
include::topics/user-storage/model-interfaces.adoc[]

View File

@@ -27,18 +27,4 @@ There are two sample projects in link:{quickstartRepo_link}[{quickstartRepo_name
|===
In order to connect to the external database, you should use the {project_name} properties for the additional datasources described in the link:https://www.keycloak.org/server/db#configure-multiple-datasources[Configure multiple datasources] guide.

View File

@@ -0,0 +1,13 @@
=== Accessing the new entity manager
In order to simply access your data in your {project_name} extension, you can obtain the link:https://jakarta.ee/specifications/persistence/3.2/apidocs/jakarta.persistence/jakarta/persistence/entitymanager[EntityManager] for the additional datasources used in these quickstarts.
It helps you to interact with entities specified for your datasource, as it provides some kind of bridge between your JPA entities and the database.
You can use the new entity manager (for the `user-store` datasource) as follows:
[source,java]
----
EntityManager em = session.getProvider(JpaConnectionProvider.class, "user-store").getEntityManager();
var user = em.find(org.your.extension.UserEntity.class, 123L);
----