| Hi, My system has a feature that we need to reach more than one database schemas in the same request Ex.:
public List<Foo> getFoo(List<String> schemas, Integer id)
{
List<Foo> foos = new ArrayList<>();
Session session = getSession();
for (String schema: schemas) {
session.setTenantId(schema);
Foo foo = session.get(Foo.class, id);
foos.add(foo);
}
return foos;
}
Today, we close the Session and open another one for each schema, we'd like to avoid close/open sessions and use only one and still have all hibernate features as first level/second level etc COA:
- Need expose setTenantId for Session and ContextualJdbcConnectionAccess (or have only one place to set and get it)
- Need add tenantId to EntityKey, CollectionKey and other classes that generate key for cache
- Able to use transactions managers (by hibernate or Spring)
|