The DataMap (model) is shared by the contexts. To make them different you need to create two different ServerRuntimes.
On Fri, Nov 18, 2016 at 3:44 AM Markus Reich <[email protected]> wrote: > Hi, > > I have a very special requirement :-) > We need to change the schema after logon (it's a JSF Tomcat WebApp) > > I tried the following > > After login > > final String SESSION_CONTEXT_KEY = > SessionContextRequestHandler.class.getName() + ".SESSION_CONTEXT"; > ObjectContext context = (ObjectContext) > session.getAttribute(SESSION_CONTEXT_KEY); > for (DbEntity dbEntity : context.getEntityResolver().getDbEntities()) { > if (dbEntity.getSchema().endsWith("crm")) { > if(Helper.getCrm()!=null) dbEntity.setSchema(Helper.getCrm()); > } else if (dbEntity.getSchema().startsWith("simpleinv_")) { > if(Helper.getEupar()!=null) dbEntity.setSchema("simpleinv_" + > Helper.getEupar()); > } > } > session.setAttribute(SESSION_CONTEXT_KEY, context); > > The switching works, until a second session is opened! The first session > loses the schema and get the one from the second? > > When I debug I have two different instances of the ObjectContext that's > perfect, but the DbEntities are the same :-/ > > regards > Meex >
