db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schmitt" <mich...@popfrontal.de>
Subject Is there any notification mechanism when deleting objects
Date Thu, 29 May 2003 23:26:37 GMT
Hello,
I have aproblem when deleting objects that are referenced by other objects.
My schema looks something like that:

<table name="band">
    <column name="id" required="true" type="INTEGER" primaryKey="true"/>
    <column name="name" required="true" type="VARCHAR" size="255" />
    ...
</table>

<table name="concert">
    <column name="id" required="true" type="INTEGER" primaryKey="true"/>
    <column name="band_id" required="true" type="INTEGER"/>
    ...
    <foreign-key foreignTable="band">
      <reference local="band_id" foreign="id"/>
    </foreign-key>
</table>


Somewhere in my sourcecode I have the following lines:

(1)  Band band = BandPeer.retrieveByPK(123);

This statement is only executed once. The returned Band object will be
kept in memory. In another place I use this object from time to time in
the following way:

(2)  List concerts = band.getConcerts();

Somewhere else (where I don't know anything about the reference) I do the 
following:

(3)  Concert concert = ConcertPeer.retrieveByPK(456);
     ConcertPeer.doDelete(concert);

If thereafter (2) is called again, the deleted Concert object is still 
in the returned list.


Is there any notification mechanism that tells the Band object that it 
should update its concert-list, or at least tells it that it should 
reread the list from the database?


bye,
michael




Mime
View raw message