Hibernate 4 includes support for specifying a tenant_id on a Session (I believe other ORMs have similar functionality already).
Could (should?) DatabaseServerLoginModule be updated to support specifying a query for retrieving this tenant_id as well as the username and password.
Thanks.