Fix for ALF-7241:

- patch to mybatis-3.0.4
  - configuration option (property 'mybatis.useLocalCaches') to disable local caches that cause problems with result handlers not returning any results

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31333 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Steven Glover
2011-10-19 09:01:34 +00:00
parent 7c576151bb
commit d053782f25
4 changed files with 8 additions and 22 deletions

View File

@@ -45,6 +45,7 @@
<!-- MyBatis config for Activities domain --> <!-- MyBatis config for Activities domain -->
<bean id="activitiesSqlSessionFactory" class="org.alfresco.ibatis.HierarchicalSqlSessionFactoryBean"> <bean id="activitiesSqlSessionFactory" class="org.alfresco.ibatis.HierarchicalSqlSessionFactoryBean">
<property name="useLocalCaches" value="${mybatis.useLocalCaches}"/>
<property name="resourceLoader" ref="dialectResourceLoader"/> <property name="resourceLoader" ref="dialectResourceLoader"/>
<property name="dataSource" ref="activitiesDataSource"/> <property name="dataSource" ref="activitiesDataSource"/>
<property name="configLocation"> <property name="configLocation">
@@ -59,6 +60,7 @@
<!-- MyBatis config for Alfresco (using common datasource) --> <!-- MyBatis config for Alfresco (using common datasource) -->
<bean id="repoSqlSessionFactory" class="org.alfresco.ibatis.HierarchicalSqlSessionFactoryBean"> <bean id="repoSqlSessionFactory" class="org.alfresco.ibatis.HierarchicalSqlSessionFactoryBean">
<property name="useLocalCaches" value="${mybatis.useLocalCaches}"/>
<property name="resourceLoader" ref="dialectResourceLoader"/> <property name="resourceLoader" ref="dialectResourceLoader"/>
<property name="dataSource" ref="dataSource"/> <property name="dataSource" ref="dataSource"/>
<property name="configLocation"> <property name="configLocation">

View File

@@ -794,4 +794,7 @@ system.content.caching.maxElementsOnDisk=10000
system.content.caching.minFileAgeMillis=60000 system.content.caching.minFileAgeMillis=60000
system.content.caching.maxUsageMB=4096 system.content.caching.maxUsageMB=4096
# maxFileSizeMB - 0 means no max file size. # maxFileSizeMB - 0 means no max file size.
system.content.caching.maxFileSizeMB=0 system.content.caching.maxFileSizeMB=0
mybatis.useLocalCaches=false

View File

@@ -165,7 +165,7 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
super.setDictionaryService(dictionaryService); super.setDictionaryService(dictionaryService);
} }
public void startBatch() public void startBatch()
{ {
// TODO // TODO
@@ -1043,8 +1043,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler); template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
@@ -1125,8 +1123,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler); template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
@@ -1211,8 +1207,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(filter, resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(filter, resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler); template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
@@ -1267,8 +1261,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
assoc.setOrdered(resultsCallback.orderResults()); assoc.setOrdered(resultsCallback.orderResults());
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler); template.select(SELECT_CHILD_ASSOCS_OF_PARENT, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
@@ -1296,9 +1288,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE, assoc, resultHandler); template.select(SELECT_CHILD_ASSOCS_OF_PARENT_WITHOUT_PARENT_ASSOCS_OF_TYPE, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
} }
@@ -1357,8 +1346,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback); ChildAssocResultHandler resultHandler = new ChildAssocResultHandler(resultsCallback);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
template.select(SELECT_PARENT_ASSOCS_OF_CHILD, assoc, resultHandler); template.select(SELECT_PARENT_ASSOCS_OF_CHILD, assoc, resultHandler);
resultsCallback.done(); resultsCallback.done();
@@ -1374,8 +1361,6 @@ public class NodeDAOImpl extends AbstractNodeDAOImpl
childNode.setId(childNodeId); childNode.setId(childNodeId);
assoc.setChildNode(childNode); assoc.setChildNode(childNode);
// TODO MyBatis workaround - see also http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
return (List<ChildAssocEntity>) template.selectList(SELECT_PARENT_ASSOCS_OF_CHILD, assoc); return (List<ChildAssocEntity>) template.selectList(SELECT_PARENT_ASSOCS_OF_CHILD, assoc);
} }

View File

@@ -199,11 +199,7 @@ public class CannedQueryDAOImpl extends AbstractCannedQueryDAOImpl
ResultHandlerTranslator<R> resultHandler = new ResultHandlerTranslator<R>(handler); ResultHandlerTranslator<R> resultHandler = new ResultHandlerTranslator<R>(handler);
try try
{ {
// TODO MyBatis workaround if ((offset == 0) && (limit == Integer.MAX_VALUE))
// http://code.google.com/p/mybatis/issues/detail?id=58 (and #139, #234, ...)
template.clearCache();
if ((offset == 0) && (limit == Integer.MAX_VALUE))
{ {
template.select(query, parameterObj, resultHandler); template.select(query, parameterObj, resultHandler);
} }