-
DescriptionIs it possible to access the Session object inside an Hibernate Interceptor? https://quarkus.io/guides/hibernate-orm#interceptors We need to propagate some user information to the database. For example, for Oracle:
We need this identifier to be propagated for em.persist, em.merge, em.createQuery("...").executeUpdate(), em.createStoredProcedureQuery("...").execute(), etc. Thank you Implementation ideasNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hello. Please use GitHub discussion for questions that are not a bug report or a precise feature request. Converting this to a discussion. |
Beta Was this translation helpful? Give feedback.
-
I don't think If you're using this to record entities as "owned" by a particular client, and filter entities down to those belonging to a particular client, I'd recommend using the built-in discriminator-based multitenancy feature instead. See https://quarkus.io/guides/hibernate-orm#discriminator-approach , https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#multitenacy-hibernate-TenantId If your use case is different, and you really just need to execute some dynamic SQL every time a connection is retrieved, then I think you need to define an interceptor in Agroal:
|
Beta Was this translation helpful? Give feedback.
I don't think
Intereceptor
is the right tool for the job, as it's primarily focused on entities, and you're focusing on the JDBC connection.If you're using this to record entities as "owned" by a particular client, and filter entities down to those belonging to a particular client, I'd recommend using the built-in discriminator-based multitenancy feature instead. See https://quarkus.io/guides/hibernate-orm#discriminator-approach , https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#multitenacy-hibernate-TenantId
If your use case is different, and you really just need to execute some dynamic SQL every time a connection is retrieved, then I think you ne…