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 Mark Berry <ma...@labpro2000.com> on 2004/03/14 05:48:57 UTC

Instance Callback Tutorial

Could someone please help me?

In the tutorial on instance call backs, how is the afterStore() method called?
I am presuming it is called from both the afterInsert() and the afterUpdate(), although these calls don't appear in the documentation.

Also is it possible to write a call back routine that will ignore these methods.

To explain this further I am writing a callback routine that will resequence a group of records.
I can copy them into and array, remove them, 
but when I go to recreate the first one, the broker.store() wants to call the resequencing method again.

BTW I am still using RC4.

Regards
Mark Berry

Re: Instance Callback Tutorial

Posted by Mark Berry <ma...@labpro2000.com>.
Thanks Armin,

The problem I've got is that I want to resequence a group of records after
the user has come out of the maintenance screen.
However as soon as we try and rewrite a record (within the call back), the
callback gets fired again and we end up in an infinite loop.

May be this code would be more appropriately placed in a genericBO?

Regards

Mark Berry


----- Original Message ----- 
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, March 16, 2004 6:26 AM
Subject: Re: Instance Callback Tutorial


> Hi Mark,
>
> Mark Berry wrote:
>
> > Could someone please help me?
> >
> > In the tutorial on instance call backs, how is the afterStore() method
called?
> > I am presuming it is called from both the afterInsert() and the
afterUpdate(),
> > although these calls don't appear in the documentation.
> >
>
> doh! Sorry, I will fix this in docs ASAP. Some time ago we split
> xxxStore call in xxxInsert/xxxUpdate calls in PersistenceBrokerAware
> interface.
>
> > Also is it possible to write a call back routine that will ignore these
methods.
> >
> > To explain this further I am writing a callback routine that will
resequence a group of records.
> > I can copy them into and array, remove them,
> > but when I go to recreate the first one, the broker.store() wants to
call the
> > resequencing method again.
> >
>
> Think I don't understand your question, but will try anyhow.
> If an object implements PersistenceBrokerAware there is no way to induce
> OJB to skip one of these methods. You have to handle this in your object
> itself.
>
> regards,
> Armin
>
> > BTW I am still using RC4.
> >
> > Regards
> > Mark Berry
>
> ---------------------------------------------------------------------
> 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: Instance Callback Tutorial

Posted by Armin Waibel <ar...@apache.org>.
Hi Mark,

Mark Berry wrote:

> Could someone please help me?
> 
> In the tutorial on instance call backs, how is the afterStore() method called?
> I am presuming it is called from both the afterInsert() and the afterUpdate(),
> although these calls don't appear in the documentation.
> 

doh! Sorry, I will fix this in docs ASAP. Some time ago we split 
xxxStore call in xxxInsert/xxxUpdate calls in PersistenceBrokerAware 
interface.

> Also is it possible to write a call back routine that will ignore these methods.
> 
> To explain this further I am writing a callback routine that will resequence a group of records.
> I can copy them into and array, remove them, 
> but when I go to recreate the first one, the broker.store() wants to call the 
> resequencing method again.
> 

Think I don't understand your question, but will try anyhow.
If an object implements PersistenceBrokerAware there is no way to induce 
OJB to skip one of these methods. You have to handle this in your object 
itself.

regards,
Armin

> BTW I am still using RC4.
> 
> Regards
> Mark Berry

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