thx for your reply . looking the example :
// get MetadataManager instance MetadataManager mm = MetadataManager.getInstance(); // enable per thread mode if not done before mm.setEnablePerThreadChanges(true); // Load additional object metadata by parsing an repository file DescriptorRepository dr_1 = mm.readDescriptorRepository("pathOrURLtoFile_1"); DescriptorRepository dr_2 = mm.readDescriptorRepository("pathOrURLtoFile_2"); // add profiles mm.addProfile("global", mm.copyOfGlobalRepository()); mm.addProfile("guest", dr_1); mm.addProfile("admin", dr_2); // now load a specific profile mm.loadProfile("admin"); broker = PersistenceBrokerFactory.defaultPersistenceBroker(); MetaManager is a singleton i think. so in this case we will have a probleme with concurence access. if user A loadProfile("guest") and just after loading guest profile another user B (profile admin) execute broker = PersistenceBrokerFactory.defaultPersistenceBroker(); so in this situation B got a broker with profile admin because MetaManager is a singleton. is right ???? On 5/24/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
Hi, ABOU LINA wrote: > Hi; > > i have two mapping file : repository1.xml and repository2.xml. > > the difference between these two file are the value of auto-* > [auto-retrieve, auto-update ..] ; at runtime sometimes i need to use > repository1.xml and somtimes the repository2.xml . > > what is the best and optimal solution about this conf ??? > You can use metadata profiles on per thread base. http://db.apache.org/ojb/docu/guides/metadata.html#Per+thread+metadata+changes http://db.apache.org/ojb/docu/guides/metadata.html#Object+metadata+profiles This way you can load a specific metadata profiles (repository1.xml or repository2.xml) for the current thread. Take care of caching issues, e.g. obj1 from rep1 was used in rep2 environment will cause undetermined behavior. Thus it's recommended to use the two-level cache or only a session based (per broker) cache. regards, Armin > thx in advance > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]