# Complex joins and raw sql query problem

**URL:** <https://discourse.hanakai.org/t/complex-joins-and-raw-sql-query-problem/687>\
**Category:** questions\
**Created:** [March 13, 2022, 7:42pm UTC](https://discourse.hanakai.org/t/complex-joins-and-raw-sql-query-problem/687 "2022-03-13T19:42:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![synu](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@synu](https://discourse.hanakai.org/u/synu)\
**Post date:** [March 20, 2022, 2:40pm UTC](https://discourse.hanakai.org/t/complex-joins-and-raw-sql-query-problem/687/3 "2022-03-20T14:40:59Z")

</div>

@sebastjan_hribar  
i think i might have to bump into the same issue in the past

> [@Connecting two Repositories to the same DB table](https://discourse.hanakai.org/t/connecting-two-repositories-to-the-same-db-table/642):
>
> Hey, i’m writing app in Hanami 1.3 and have hard time trying to connect two repositories to the same table. Is it doable in Hanami 1.3? I dug a little bit and it looks to me that either rom in version 3 doesn’t support this, or it’s some missing feature in Hanami-model. I tried to hack around, and managed to connect two Repository classes using the same relation (had to make some changes in ROM gem), but i still cannot make second repository to map data to different Entity. Again, does anyon…

as i remember (but i’m not sure i do 😛 ) i also had troubles with mapping to different Entities. I guess it’s not working in Hanami 1.3.

For me, the solution was migrating to ROM 5.2 🙂

---

_[View the full topic](https://discourse.hanakai.org/t/complex-joins-and-raw-sql-query-problem/687)._
