What is the appropriate connection pool configuration for using Oracle VPD with Hibernate in JBoss?
Issue
- We use Oracle VPD to access our database which means that every database connection must be configured with VPD session data prior to using it, to ensure that it uses the correct VPD security. Our approach has been to configure a Hibernate session's JDBC connection before using the session. When the database operation to satisfy the lazy fetch is done, which is after the call to load(), Hibernate can sometimes go back to the connection pool to get a new JDBC connection instead of using the one in the session that initiated the call. That new connection has not been configured for VPD, and so can either be unconfigured or carry another session's configuration. The resulting database operation can then be done with the wrong VPD session.
Environment
- JBoss Enterprise Application Platform (EAP) 5.0
- Oracle Virtual Private Databases (VPD)
- Hibernate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
