我正在研究的项目与DAOs下面的项目有类似的结构:
/**
* Base DAO class
*/
@Transactional
public class JPABase {
@PersistenceContext
private EntityManager entityManager;
public void persist(Object entity) {
entityManager.persist(entity);
}
//some more methods in here
}
Run Code Online (Sandbox Code Playgroud)
和
/**
* Generic DAO class implementation
*/
@Transactional
public abstract class GenericDao extends JpaBase {
//some methods in here
}
Run Code Online (Sandbox Code Playgroud)
和
/**
* Specialized DAO class
*/
@Repository
@Transactional
public class PersonDao extends GenericDao {
//some methods in here
}
Run Code Online (Sandbox Code Playgroud)
到现在为止,该项目使用的编译时编织,但而配置也改为使用<context:load-time-weaver/>与-javaagent:/opt/tomcat7-1/lib/spring-instrument.jar.
由于已经应用了这种改变,因此不再编织JpaBase's和 …