I finally got some time to implement the idea that I mentioned in previous blog. After struggling for hours with Spring AOP, I realized I needed CGLIB to proxy abstract class!
Spring and DAO w/ Annotation
Although EJB is moving forward to 3.0, and everyone seems to enjoy the POJO ORM stuff. I do miss some EJB 2.0 features. Particularly, being able to use the ejbSelect and finder methods! With xdoclet, one could easily annotate a method with its corresponding query.
/** * @ejb.select query="...." */ public abstract Collection ejbSelectWithKey(String key) throws FinderException;
Although it seems like named queries are to replace the use of this kind of methods. I still enjoyed the fact that the method is, afterall, a Java method. The Java language can provide name, parameter, and type checkings to this method, where named queries can’t.
I could imaging something similar w/ Spring and DAO, and some simple AOP/proxy to achieve the following: