Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ and Dao class

While I can think of ways for AspectJ to help here, a more appropriate solution might be to use Spring's JDBCTemplate class. It solves this problem and much more. Note that you can use this class even if your architecture is not based on Spring i.e. you can use Spring just like any other library.

-Ramnivas

On 8/22/07, fyu33 <fyu33@xxxxxxxxxxx> wrote:
Hello, In a JDBC DAO implementatin class, we usually see the following pattern: ... private DataSource ds; public aMethod(){ Connection cx = null; try{ cx = ds.getConnection(); ... }catch(Exception e){ ... }finally{ if(cx!=null){ try{ cx.close(); }catch(){ } } ... } it is tiring to code the same thing in all DAO methods. I am looking for a sample code showing how to use AspectJ to handle this. Thanks! Franck

View this message in context: AspectJ and Dao class
Sent from the AspectJ - users mailing list archive at Nabble.com.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top