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 16:27:12 UTC

Réf. : Re: Réf. : Re: Mixing OJB objects with non-OJB objects




No, I don't thik so, since the object is not instantiated by OJB. If I take
again the example of the Car and its Owner, the Car object is instantiated
by OJB, because the data is stored in the RDBMS and retrieved using the
PersistenceBroker.
The Owner object must be read from an external application and cannot by
retrieved by OJB. To do that, I overwrite RowReader.readObjectFrom() to add
a couple of instruction that access the external application, create the
owner instance and set it to the car.
I would like to add the owner to the OJB cache so it would be cleared at
the same time that all other objects of the application, regardless if they
have been retrieved through OJB or not.

Stefano



|---------+--------------------------->
|         |           Thomas Dudziak  |
|         |           <tomdz@first.fhg|
|         |           .de>            |
|         |                           |
|         |           08.07.2004 16:14|
|         |           Veuillez        |
|         |           répondre à "OJB |
|         |           Users List"     |
|         |                           |
|---------+--------------------------->
  >----------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                      |
  |        Pour :   OJB Users List <oj...@db.apache.org>                                                              |
  |        cc :                                                                                                          |
  |        Objet :  Re: Réf. : Re: Mixing OJB objects with non-OJB objects                                               |
  >----------------------------------------------------------------------------------------------------------------------|




Stefano.Juri@zas.admin.ch wrote:

>Yes, I know that, but if I am in my custom RowReader extending
>DefaultRowReader, how can I get a reference to the PersisitenceBroker ? In
>other words, is there a way to navigate OJB from
RowReader.readObjectFrom()
>to the PersistenceBroker ?
>
>
Mhm, not directly. You could try to obtain a persistence broker instance
the normal way (e.g. standard PersistenceBroker Api) from within the row
reader, but I don't know whether that works.
Are you sure that your customly-loaded objects are not cached (I see no
reason why a custom row reader should affect the cache handling as long
as the custom objects have a valid identity) ?

Tom


---------------------------------------------------------------------
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


Re: Réf. : Re: Réf. : Re: Mixing OJB objects with non-OJB objects

Posted by Thomas Dudziak <to...@first.fhg.de>.
Stefano.Juri@zas.admin.ch wrote:

>No, I don't thik so, since the object is not instantiated by OJB. If I take
>again the example of the Car and its Owner, the Car object is instantiated
>by OJB, because the data is stored in the RDBMS and retrieved using the
>PersistenceBroker.
>The Owner object must be read from an external application and cannot by
>retrieved by OJB. To do that, I overwrite RowReader.readObjectFrom() to add
>a couple of instruction that access the external application, create the
>owner instance and set it to the car.
>I would like to add the owner to the OJB cache so it would be cleared at
>the same time that all other objects of the application, regardless if they
>have been retrieved through OJB or not.
>  
>
If you look into the RowReaderDefaultImpl, you'll see that there is no 
cache handling in there at all. This is because the cache works with 
java objects regardless of where they come from (see the ObjectCache 
implementations). Therefore, in your case it should not matter where the 
object comes from.
Please check whether your external objects are cached, e.g. build the 
debug OJB version via the jar-debug Ant target and add a breakpoint in 
the lookup method of the cache impl that you're using.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org