You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ian Hunter <ih...@hunterweb.net> on 2004/08/03 17:27:17 UTC
Object with links to objects from a different database
I have a system that uses one database for storing 95% of it's data, but 5%
of it lives in a separate ERP that I'm linking to. OJB is talking to both
databases just fine, but when I try to load an object that has auto-retrieve
turned on that also happens to reference an object in a different database,
OJB can't figure out that the "subobject" lives elsewhere and tries to
access its table in the current database.
Help?!?!
---
Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht
oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist
and lsat ltteer be at the rghit pclae. The rset can be a total mses and you
can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not
raed ervey lteter by istlef, but the wrod as a wlohe.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Object with links to objects from a different database
Posted by Armin Waibel <ar...@apache.org>.
Hi Ian,
Ian Hunter wrote:
> I have a system that uses one database for storing 95% of it's data, but 5%
> of it lives in a separate ERP that I'm linking to. OJB is talking to both
> databases just fine, but when I try to load an object that has auto-retrieve
> turned on that also happens to reference an object in a different database,
> OJB can't figure out that the "subobject" lives elsewhere and tries to
> access its table in the current database.
OJB doesn't support materialization of objects made up of different DB.
There is a feature request to support this but I don't like it, because
of the complications on insert/update/delete of these composed objects
(in that case need a 'OJB internal' distributed transaction support to
guarantee synchronization of databases).
So you have to handle this stuff by your own using a thin layer on top
of OJB. Here a simple example how you can handle this:
broker_1 ---> DB_1
broker_2 ---> DB_2
MyObject composed = (MyObject) broker_1.getObjectByIdentity(oid);
broker_2.retrieveReference(composed, "refFieldNameToLoadFromDB_2");
That's all! Now the object should have data from DB_1 and the reference
read from DB_2.
regards,
Armin
>
> Help?!?!
>
> ---
> Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht
> oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist
> and lsat ltteer be at the rghit pclae. The rset can be a total mses and you
> can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not
> raed ervey lteter by istlef, but the wrod as a wlohe.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org