Add multitenancy module: Hibernate 7 @TenantId vs schema-per-tenant (shared pool + search_path, pool per tenant), JWT tenant filter, isolation failure modes on PostgreSQL 17 (Hibernate 7.4.14.Final, Spring Boot 4.1.2)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4VQVEJWetTT1dYzyJ
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# a provider that does not reset search_path on release (tenancy.mode=leaky), pool size 1
|
||||
|
||||
== Hibernate finished a request as acme and gave the connection back; now an unrelated component borrows it
|
||||
-- direct DataSource connection, tenant context empty
|
||||
show search_path -> acme
|
||||
select count(*) from invoice -> 1 (acme's data, read with no tenant at all)
|
||||
|
||||
== the same experiment with the correct provider (resetOnRelease=true), pool size 1, provider called the way Hibernate calls it
|
||||
-- after getConnection("acme") + releaseConnection("acme", ..): show search_path -> "$user", public
|
||||
-- select count(*) from invoice -> java.lang.IllegalStateException: org.postgresql.util.PSQLException: ERROR: relation "invoice" does not exist <- caused by org.postgresql.util.PSQLException: ERROR: relation "invoice" does not exist
|
||||
Reference in New Issue
Block a user