You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by "Robert A. Decker" <rd...@pgp.com> on 2007/10/03 19:40:15 UTC

CayenneDataObject eof equivalent method for awakeFromInsertion

I've looked through the API doc for CayenneDataObject but wasn't able  
to find what I'm looking for. Is there a method similar to eof's  
awakeFromInsertion?

I'm looking for a method that is called when a data object (in my  
case, a CayenneDataObject subclass) is inserted into a DataContext.

For what I'm doing I can probably get away with putting my code in  
the consructor for my class, but I'd rather put it in a method that's  
called automatically when the data object is inserted into a context.

Thanks,
R

Re: CayenneDataObject eof equivalent method for awakeFromInsertion

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Oct 3, 2007, at 8:40 PM, Robert A. Decker wrote:

> I've looked through the API doc for CayenneDataObject but wasn't  
> able to find what I'm looking for. Is there a method similar to  
> eof's awakeFromInsertion?
>
> I'm looking for a method that is called when a data object (in my  
> case, a CayenneDataObject subclass) is inserted into a DataContext.
>
> For what I'm doing I can probably get away with putting my code in  
> the consructor for my class, but I'd rather put it in a method  
> that's called automatically when the data object is inserted into a  
> context.
>
> Thanks,
> R

In 3.0 you'd use lifecycle callbacks:

http://cayenne.apache.org/doc/lifecycle-callbacks.html

(still catching up with Modeler support, so there's some code  
involved in setting those up)

Andrus