Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'd start to observe the following:</p> <ul> <li>You have a <code>GenericDao&lt;T&gt;</code> which means that you can have different implementations.</li> <li>Currently, you have <code>GenericDaoImpl&lt;T&gt; extends JdbcDaoSupport</code> which means that you cannot use in the other environment you described without any application context unless you prepare all the object in a manual fashion.</li> </ul> <p>So my suggestion is:</p> <ul> <li>Allow <code>GenericDao&lt;T&gt; extends org.springframework.jdbc.core.JdbcOperations</code></li> <li>Develop an <code>AbstractGenericDao&lt;T&gt; implements GenericDao&lt;T&gt;</code> to bring the abstract general functionality you need.</li> <li>Develop a <code>MyEnvGenericDao&lt;T&gt; extends AbstractGenericDao&lt;T&gt;</code> that is responsible to provide a <em>data source</em> and underlying implementation of different methods you need; could be using a direct Hibernate/OpenJPA implementation to directly executing the queries.</li> <li>Develop a <code>SpringGenericDao&lt;T&gt; extends JdbcDaoSupport implements GenericDao&lt;T&gt;</code> that comes is already with a <code>getJdbcTemplate()</code> to perform the operations you need and is delegated to Spring JDBC template. In this scenario, you need to delegate the operations to <code>JdbcDaoSupport.getJdbcTemplate()</code>.</li> </ul> <p>Related to Maven, then you can actually have different modules for <code>MyEnv</code> and <code>Spring</code> implementations but both with one parent to have access to <code>GenericDao&lt;T&gt;</code> interface.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload