[EMAIL PROTECTED] wrote:
Hello,
I have two types of persistent objects in my application : objects that are stored in a RDB and objects that are managed from an other application (for instance, in my environment persons and adresses are managed in a legacy application developed in Natural/Adabas). The objects of the second type are considered as read-only, I don'need to store them back after the processing. The objects of both types are mixed in the business model, the business layer of the application does not need to bother where the data is stored.
Example : I have a class Car with has an Owner. Car is stored in my RDB and the table contains the identifier of the owner. Owner is stored in the external application. When OJB instantiates aCar it should also instantiate it's Owner.
I tried with the factory-class, but since the factory-method does not accept parameters, I don't know how to pass the identifier of the owner and I need that information to call the external application's API. Is there a way to get access to the db-row from the factory-method ? If no, is there a smarter way to do the job ?
Dependiding on whether you want to map the Owner's identifier to a field of Car, you can use initialization-method (class descriptor) which is called after OJB has read the object from the database (if I'm not mistaken), or you can use a custom row-reader implementation to fetch the additional row from the db:
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Using+Rowreader
Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
