Actually i have an application using cayenne 3.1 stack, with postgress 9.3 as database, that implements multiteancy creating a separate ServerRuntime per "Company" that relocates DbEntities on a specific postgress schema, using an XMLDataMapLoader with overrided load method as follow:
public DataMap load(Resource configurationResource) { DataMap map = super.load(configurationResource); map.setDefaultSchema(tenantSchema); for (DbEntity e : map.getDbEntities()) { e.setSchema(tenantSchema); String sequence = tenantSchema.concat(".").concat(e.getPrimaryKeyGenerator().getGeneratorName()); e.getPrimaryKeyGenerator().setGeneratorName(sequence); } return map; } As result i have a serverruntime per "Company" from which every user obtains his own ObjectContext(s). Now i would need to map some tables into a shared schema. Was thinking about to point just the tables that must be separated per company, into the company specific schema, leaving those that are meant to be share into the public schema. Clearly there are no relationships between the "shared" entities and the "Company" ones. Any advice orsuggestions will be greatly appreciated. Thanks, Emanuele