Erik Hatcher wrote:


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.


IMO a proxy wrapped POJO is more transparent because it works properly no matter who and why calls its methods. My trick works with the assumption
that transactions starts when a thread enters first DAO layer method and finishes when the thread leaves it. It also correctly propagates the same transaction to all others call of DAO layer if necessary.


So, I do not know details of your implementation, but generally speaking if your object has business methods and they invoke DAO layer, then my trick works just fine.

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?

The trick is to intercept invocations of all or selected methods on certain DAO objects (singletons) no matter who invokes them.
That is just a matter of using proper HM interceptor, pretty much like the one I have used to compare performance of AOP
http://kgionline.com/articles/aop_1/aop_perf.jsp , scroll down to HM case.



Let me repeat one more time - the trick completely decouples DAO from all its users (UI, batch, WS, etc).
Actually all those DAOs become equivalents of Stateless Session Beans where every method is transactional.


That may or may not work for you, but I certainly discourage explicit transaction management in UI.

--
Thanks,

Konstantin Ignatyev

http://www.kgionline.com





PS: If this is a typical day on planet earth, humans will add fifteen million 
tons of carbon to the atmosphere, destroy 115 square miles of tropical 
rainforest, create seventy-two miles of desert, eliminate between forty to one 
hundred species, erode seventy-one million tons of topsoil, add 2.700 tons of 
CFCs to the stratosphere, and increase their population by 263.000

Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206)


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



Reply via email to