On 05/12/2013 21:47, Oliver Wulff wrote:
Hi there

Hi Oliver,

Wouldn't it make sense to use a BasicDataSource instead of 
DriverManagerDataSource as it is also recommended from Spring:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/jdbc.html#jdbc-connections

Short answer: Yes, why not?

Long answer follows.

The localDataSource bean in persistenceContext.xml is there for providing a DataSource for non-production usage: unit and integration tests, various development profiles [1], embedded mode [2] and standalone distribution [3].

As you can see from syncopeContext.xml, things are arranged so that at first a JNDI lookup for a proper DataSource is performed: this becomes of fundamental importance in production environments, as we suggest [4].

Moreover, usage of BasicDataSource implies commons-dbcp dependency, which is currently indirectly pulled in by Activiti (org.activiti:activiti-spring, exactly).

Hence, I am +-0 for this change.

Instead of this:

   <bean id="localDataSource" 
class="org.springframework.jdbc.datasource.IsolationLevelDataSourceAdapter">
     <property name="targetDataSource">
       <bean 
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
         <property name="driverClassName" value="${jpa.driverClassName}"/>
         <property name="url" value="${jpa.url}"/>
         <property name="username" value="${jpa.username}"/>
         <property name="password" value="${jpa.password}"/>
       </bean>
     </property>
     <property name="isolationLevelName" value="ISOLATION_READ_COMMITTED"/>
   </bean>


we can configure this bean:

   <bean id="localDataSource" 
class="org.springframework.jdbc.datasource.IsolationLevelDataSourceAdapter">
     <property name="targetDataSource">
      <bean class="org.apache.commons.dbcp.BasicDataSource"
           destroy-method="close">
         <property name="driverClassName" value="${jpa.driverClassName}"/>
         <property name="url" value="${jpa.url}"/>
         <property name="username" value="${jpa.username}"/>
         <property name="password" value="${jpa.password}"/>
       </bean>
     </property>
     <property name="isolationLevelName" value="ISOLATION_READ_COMMITTED"/>
   </bean>

If you like such change, please file an issue and attach a patch there.

Regards.

[1] http://syncope.apache.org/building.html#More_build_profiles
[2] https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+embedded+mode [3] https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standalone+distribution [4] https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+real+environments#RunSyncopeinrealenvironments-Usedatasource

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
http://people.apache.org/~ilgrosso/

Reply via email to