I've worked as a Full Stack Java Web Developer for many years now and of all the projects I have worked on two things are true of all of them:

  1. They were all Multi-Tenant applications with one database/one schema architecture
  2. They never utilized a Rapid-Application-Development framework (J2EE and Spring only)

I can't deny that there is a lot of boiler-plate code in many of the things I do for my day-to-day tasks so I'm interested in mastering a Rapid Application Development framework that won't compromise on power and will support a multi-tenant architecture. I have to invest a great deal of energy in writing, testing and maintaining DAO classes, as well as making sure that the CRUD operations are secure enough to make sure one tenant cannot access/modify another tenant's data, so a Hibernate-style option seems like it would be a great time saver.

However, Hibernate does not support multi-tenant databases that are one db/one schema. I shudder at the idea of separate databases or schema per client. For one thing we would be remotely hosted so I imagine the costs of supporting many databases for lots of small clients, many of whom may not even be active users, would be prohibitive. Secondly, a lot of tech support goes into looking for data abnormalities in the database, and being able to query across data in a central location is an invaluable time saver.

Spring Boot seems like a good choice here, but it's based on Hibernate which does not yet allow for the use of a Discriminator approach (which would allow for a one-database/one-schema) model. Is there a viable RAD framework that works well for Multi-Tenant Enterprise development? Alternatively, is it easy/possible to implement such an architecture in an existing framework?

  • 1
    Well, at the end of the day, multi-tenancy can be as simple as an additional WHERE clause on all of your SQL queries. Commented Jul 25, 2016 at 15:40

1 Answer 1


People have different ideas of RAD - in fact, it's a rarely used phrase these days. Technologies like Spring Roo are great for prototyping, but not usually used for commercial apps. Once your app has a certain degree of customisation, Roo is more trouble than help. Technologies like Hibernate or Vaadin - which some would call RAD - are widely used in commercial apps.

Hibernate can certainly do multi-tenant if you manually add a tenant criteria to clauses, and specify the tenant on new objects. If you want something more automatic, I've blogged about at approach for SQLAlchemy. You could do the same with Hibernate. http://pajhome.org.uk/security/clouddata.html

Virtual Private Database (also called row level security) is another option. Don't dismiss running per-tenant databases or app instances. While I understand your objections, I've seen many very successful (and profitable) systems that work that way.

  • Nice article. You posted it a while ago: have you implemented this in projects? How did it work for you?
    – IcedDante
    Commented Jul 25, 2016 at 17:22
  • @IcedDante - only used on linkedretail.co.uk. Works great technically although not a commercial success. I tend to be involved in apps late in the dev cycle - too late to introduce this idea :(
    – paj28
    Commented Jul 25, 2016 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.