I’ve encountered a peculiar issue with Hibernate, specifically related to partitioned multitenancy using the @TenantId annotation. The multitenancy feature seems not to work when directly fetching objects using findById (it works in other cases).
Does the multitenancy work differently when trying to get records by id? I’m really confused and spent so much time on this.
If anyone has insights or a workaround for this, your help would be greatly appreciated.
>Solution :
There is an existing bug in Hibernate 6.2. It seems like it could be the reason why it doesnt work for you:
https://hibernate.atlassian.net/browse/HHH-16835
It is marked as resolved but actually the bug is still there (https://hibernate.atlassian.net/browse/HHH-16830 https://hibernate.atlassian.net/browse/HHH-14968)