-
Code Duplication
I have found a code duplication, I stumble across several times. The code duplication I have noticed looks like:
HibernateDaoSupport:
Code:
protected final Session getSession(boolean allowCreate)
throws DataAccessResourceFailureException, IllegalStateException {
return (!allowCreate ?
SessionFactoryUtils.getSession(getSessionFactory(), false) :
SessionFactoryUtils.getSession(getSessionFactory(),
this.hibernateTemplate.getEntityInterceptor(),
this.hibernateTemplate.getJdbcExceptionTranslator()));
}
And is repeated in HibernateTemplate:
Code:
public Object execute(HibernateCallback action) throws DataAccessException {
Session session = (!isAllowCreate() ?
SessionFactoryUtils.getSession(getSessionFactory(), false) :
SessionFactoryUtils.getSession(getSessionFactory(), getEntityInterceptor(),
getJdbcExceptionTranslator()));
.....}
I would like to see this changed, because code duplication makes me nervous :).