I do something like this:

List<HoMovimentosAplicacoes> movs = new ArrayList<HoMovimentosAplicacoes>();
for (HoMovimentosAplicacoes mov : apl.getHoMovimentosAplicacoesArray())
        movs.add(mov);
for (int i = 0; i < movs.size(); i++)
        apl.removeFromHoMovimentosAplicacoesArray(movs.get(i));
manager.getContext().deleteObjects(movs);

Do I need to remove the objects from the relationships before deleting them or
just delete them?

Thanx
Bruno

-----Mensagem original-----
De: Andrus Adamchik [mailto:[email protected]] 
Enviada: sábado, 6 de Novembro de 2010 16:57
Para: [email protected]
Assunto: Re: pre-remove, post-remove

Hi,

Just found a bit unrelated issue with POST_LOAD callback:

https://issues.apache.org/jira/browse/CAY-1503

For your case, it should help if you could post a code example with comments on
where you are seeing and not seeing the callbacks.

Andrus


On Nov 1, 2010, at 8:10 PM, Bruno René Santos wrote:

> Hello all,
> 
> I am having a possibly strange behaviour on my lifecycle callbacks. Imagine de
> following scenario:
> 
> 1 textfield and 1 table on a web application. I fill table with query results
> depending on the textfield value. Each time i get a valueChange event on the
> textField I remove all lines from table and create new ones. As each line is a
> cayennedataobject, each time I do this procedure I call deleteObject for each
> old line that was removed when new lines are created. In the end I
commitChanges
> and only the last lines are saved in relation with the superclass. 
> 
> The problem here is the following. For each erased line cayenne call the
> preremove callback where I create a log for the table removal, in pending
state.
> The state of the object is modified (this is the first weird thing, shouldn’t
be
> new?) after the preRemove callback the desired process is done but Cayenne
never
> calls the postRemove callback on this situation, for other regular deletes
> everything works.
> 
> Anybody recalls a situation where the preXX callback is called but not the
> postXX? 
> 
> Thanx
> Bruno Santos
> 
> 


Reply via email to