Tuesday, August 23, 2011

EclipseLink: Multitenancy with Oracle VPD

As of EclipseLink Indigo (2.3.0) you have been able to use the @Multitenant feature to share a database schema between multiple tenants. Did you know that you can also use this feature together with the Oracle Virtual Private Database (VPD) support that has been available in EclipseLink since version 1.0?

This powerful combination of features allows for the shared tables to be managed directly on the database, and for inserts to be automatically associated with the proper client. Any SQL executed by EclipseLink (even if EclipseLink did not generate it - ie native queries) will go through VPD and return only the client specific rows.

Since VPD can be configured per table, applications can be configured to use VPD on some tables, and share others.

A running example, complete with source code is available on the EclipseLink wiki.


No comments: