# Custom Storage SPI with Hibernate

**URL:** <https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567>\
**Category:** Getting advice\
**Tags:** user-federation\
**Created:** [September 22, 2022, 7:30pm UTC](https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567 "2022-09-22T19:30:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farid.galandarli](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@farid.galandarli](https://forum.keycloak.org/u/farid.galandarli)\
**Post date:** [September 22, 2022, 7:30pm UTC](https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567/1 "2022-09-22T19:30:22Z")

</div>

Hello everyone. I have been tasked to implement Keycloak with custom Storage SPI. Thanks to this beautiful video [KEYCLOAK Implementing Custom User Storage Provider (in-depth) | Niko Köbler (@dasniko)](https://www.youtube.com/watch?v=1UklqPPjcRY&ab_channel=NikoK%C3%B6bler%28%40dasniko%29), I was able to implement and get it to work without any issue.

But the problem is, I need to implement a database connection using Hibernate (or Spring Data) and I tried many times with different configurations, but can’t get it to work.  
I even tried [Multiple persistence units (Quarkus)](https://quarkus.io/guides/hibernate-orm#multiple-persistence-units) and EJB Persistence to get it to work, but it won’t work.

Has anyone tried and made it work? If so, I really appreciate it if you could help me.  
By the way: I am using Keycloak 19.0.1

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [September 22, 2022, 8:31pm UTC](https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567/2 "2022-09-22T20:31:47Z")

</div>

> **[keycloak-quickstarts/user-storage-jpa at latest · keycloak/keycloak-quickstarts](https://github.com/keycloak/keycloak-quickstarts/tree/latest/user-storage-jpa)**
>
> latest/user-storage-jpa

---

<div class="post-metadata">

**Author:** ![farid.galandarli](https://avatars.discourse-cdn.com/v4/letter/f/b9bd4f/32.png) [@farid.galandarli](https://forum.keycloak.org/u/farid.galandarli)\
**Post date:** [September 23, 2022, 5:44am UTC](https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567/3 "2022-09-23T05:44:39Z")

</div>

Thanks for the response. It worked without any problem 🙂

---

<div class="post-metadata">

**Author:** ![ayoub96anbara](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ayoub96anbara/32/4355_2.png) [@ayoub96anbara](https://forum.keycloak.org/u/ayoub96anbara)\
**Post date:** [September 27, 2022, 2:16pm UTC](https://forum.keycloak.org/t/custom-storage-spi-with-hibernate/17567/4 "2022-09-27T14:16:52Z")

</div>

> **[GitHub - opensingular/singular-keycloak-database-federation: Keycloak User...](https://github.com/opensingular/singular-keycloak-database-federation)**
>
> Keycloak User Storage SPI for Relational Databases (Keycloak User Federation, supports postgresql, mysql, oracle and mysql) - GitHub - opensingular/singular-keycloak-database-federation: Keycloak U...
