Some comments:
Nebob wrote:
Firstly, you are inventing your own declarative transaction management solution. AOP is a good tool to use for this, but there are containers which do this for you already, and probably more robustly and correctly.
Agree.
Nebob wrote:
Second, full-on AOP is not usually necessary. It is enough to use more coarse grained interception, such as a servlet filter and avoid introducing AOP dependencies.
It very much depends on the granularity he wants to obtain. Introducing aop dependencies is like introducing any other dependency so this is not wrong from the beginning.
Moreover, there have been benchmarks driven for comparing proxy-based vs bytecode aop solutions where the later are performing better.
Nebob wrote:
Thirdly, wrapping each method or even dao class in its own session prevents multiple daos from collaborating using the same session, which is often useful.
This is definitely true. Most probably the aspects that would solve correctly this would be perthread, but I am not aware of a bytecode aop solution having this option (it has been removed in previous versions).
Concluding: as a theoretical demo, this is one of the best ideas, but recreating the wheel for production it's not.
take care,
:alex |.::the_mindstorm::.|