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 St...@zas.admin.ch on 2004/07/08 08:50:34 UTC
Mixing OJB objects with non-OJB objects
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 ?
Thank you for the help
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Mixing OJB objects with non-OJB objects
Posted by Thomas Dudziak <to...@first.fhg.de>.
Stefano.Juri@zas.admin.ch 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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Use one OJB cache for 2 application
Posted by Reda Benzair <re...@smartjog.com>.
Hello
Can I use only one OJB cache for two applications
How to make and what is the special configuration
I have TOMCAT +Oracle and Webapp 1 + Webapp 2 but I would be user one
repository, one cache
Thank you for the answer
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org