By alexismp on juin 28, 2011
This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.
Here's a short (5-minute) screencast showing GlassFish 3.1.1 (due out real soon now) and its EclipseLink 2.3 JPA provider showing multitenancy in action. In short, it adds EclipseLink annotations to a JPA entity and deploys two identical applications with different
tenant-id properties defined in the
persistence.xml descriptor. Each application only sees its own data, yet everything is stored in the same table which was augmented with a discriminator column.
For more advanced (or more realistic) uses such as tenant property being set on the
@PersistenceContext, XML configuration of multitenant JPA entities, and more check out the nicely written wiki page.