On May 11, 2005, at 9:46 AM, Konstantin Iignatyev wrote:

Erik Hatcher wrote:



My most recent struggle is with integrating auto-commit (via Cayenne) for all of my listener methods without them having to explicitly have a Cayenne dependence and mandating that they individually call the Cayenne commit API. IM'ing with Howard a bit, he gave me some tips on how to hook listener methods. I opted for the simplest one, by overriding getListeners() and creating custom IActionListener's around the ones provided by Tapestry itself. This worked great, until I hit a page that throws a RedirectException. So now I have to code in the catching of (Page)RedirectException and re-throw it. I don't think it is right to use exceptions for flow control.



Why do not push this responsibility down to DAO layer wrapper?

My "DAO" layer is Cayenne, and I'm accessing my persistent business objects directly from my Tapestry listener methods. These business objects have methods, and aren't just data holders.


I want the transaction to either commit or rollback after a listener method is done.

I think that my trick: CGLib proxy for DAO classes, would do exactly what you are trying to accomplish, and will do that absolutely transparently
http://kgionline.com/articles/aop_1/aop1.jsp
Another example of real use: http://kgionline.com/xflow2/doc/xflow2/ code_tricks.html

I don't see how it'd be transparent. What is more transparent than a listener that doesn't have any explicit commits or rollbacks in it? In fact, my Tapestry code will have no direct use of Cayenne's API if all goes as planned.


Ant by the way the same trick could be done with HiveMind - I tried and it works.

There is not a way to intercept listener method invocations with HiveMind that I know of. If you know of a way, could you please share?


Thanks,
    Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to