Hi Bobby,
Bobby Lawrence wrote:
I coudn't find a definitive answer for this anywhere, but could someone point me in the right direction?
I have two databases.
One is MySQL and the other is Oracle.
All people info is stored in Oracle.
All training info is stored in MySQL.
I want to build one object from both of those datasources that will have a person's name and a list of all the training classes that they took.
The MySQL training database stores a person's id, but nothing else.
I was hoping that I could configure this in the repository.xml file and not have to do it at runtime, but I have not found any documentation or examples.
Can this be done?
Sorry this is not possible out of the box (there will be many complications to realize such a solution, e.g. distributed tx when write those objects).
A PersistenceBroker instance could only handle one DB/connection at a time. To build the "one object from both of those datasources" (will call it "PersonTraining") you need two broker instances one for each DB (lookup in PBF via different PBKey).
In OJB 1.0.x the handling is a little bit tricky (in OJB 1.1 it will be much simpler to implement such a solution), because by default all connections declared in OJB operate on one metadata model (declared class-descriptor's).
You can declare Person and Training in the repository but you have to know at runtime which class belongs to which DB and build PersonTraining at runtime by your own using a list of Training and a Person object (or using a report query to only query the name of the Person). If don't know the which DB belongs to which class you could use custom attributes in the class-descriptor to specify the DB (e.g. set the jcdAlias name of the connection), then you can decide at runtime which connection to use for the given class.
http://db.apache.org/ojb/docu/guides/repository.html#custom+attribute
regards, Armin
If so, can someone point me in the right direction?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
