cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: How to use TransactionDelegate to do audit logging?
Date Tue, 03 Oct 2006 05:49:12 GMT

On 03/10/2006, at 3:00 PM, Jeff de Vries wrote:

> Thanks!  Couple more questions ...
> 1) Where do I get 3.0?  Nightly snapshot?  Is any one more stable  
> than any other?  Any installation instructions? Or things to watch  
> out for?

Use svn to get a local checkout of the source. Then install maven on  
your computer and:

# mvn install

The product gets put in the world's longest path, somewhere inside  
~/.m2/  Just look at the last couple of messages in the maven build.

> 2) Is the "handleCallback" argument actually the name of the method  
> to call as the callback, aka "myPostPersist"?

That's the idea. We have methods like this in the entities:

protected void prePersist() {
	// do something

> 3) Where is the proper place to set up the callbacks?  In a custom  
> data context factory (assuming you always want the callbacks)?   
> This is for a web app using thread data contexts.

Where you initialise Cayenne.

> 4) Where do I get the domain object?

Configuration conf = Configuration.getSharedConfiguration();
dataDomain = conf.getDomain();

LifecycleEventCallbackMap aCallback = dataDomain.getEntityResolver 
().getCallbacks( LifecycleEventCallback.PRE_PERSIST );
aCallback.addListener( Foo.class, "prePersist" );

Ari Maniatis

Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message