Hi again Stefan, [EMAIL PROTECTED] wrote:
currently you can only have one jdbc-connection-descriptor per repository.Hi,I would like to know what possibilties exist for using OJB with multiple databases at the same time?
In order to work against multiple databases you just have to use different broker bound against different repositories.
There is a sample repositoryFarAway.xml and respective testcases showing how to do this.
In the near future working with multiple DBs will become even easier by allowing multiple jdbc-connection-descriptor per repository.
Can I store one object in one DB and another in another DB?
Yes, please refer to the "faraway" samples.
Do I have to instantiate 2 brokers and feed them different config files?
correct!
Say you have databases A and B. You also have two classes ClassA (mapped to A) and ClassB (mapped to B).Can I store parts of an object in one DB and other parts in another? If so, how do I then build the complete object during lookup?
ClassA holds a reference to a ClassB object.
now follow these steps:
1. obtain two broker instances brokerA and brokerB working against the A and B database respectively.
2. call
ClassA a = (ClassA) brokerA.getObjectByQuery(...);
to load the instance a. To avoid automatic (and in this case wrong) retrieval of the ClassB reference the respective reference-descriptor must be set to auto-retrieve="false"
3. call
brokerB.retrieveAllReferences(a);
to use the brokerB to retrieve the ClassB reference explicitely.
cheers,
Thomas
Background is that we have an ERP database and our own extra database which enriches the ERP database with extra data. Thanks for any suggestions and merry Xmas, Stefan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
