I have found a code duplication, I stumble across several times. The code duplication I have noticed looks like:
HibernateDaoSupport:
And is repeated in HibernateTemplate: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())); }
I would like to see this changed, because code duplication makes me nervousCode:public Object execute(HibernateCallback action) throws DataAccessException { Session session = (!isAllowCreate() ? SessionFactoryUtils.getSession(getSessionFactory(), false) : SessionFactoryUtils.getSession(getSessionFactory(), getEntityInterceptor(), getJdbcExceptionTranslator())); .....}.


.
Reply With Quote