PRODSEC-5799 Upgrade mybatis (#879)

This commit is contained in:
Piotr Żurek
2022-01-18 10:33:46 +01:00
committed by GitHub
parent d8f086640a
commit d0dbef04f4
4 changed files with 58 additions and 15 deletions

View File

@@ -427,12 +427,12 @@
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
<version>3.3.0</version> <version>3.5.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId> <artifactId>mybatis-spring</artifactId>
<version>1.2.5</version> <version>2.0.6</version>
</dependency> </dependency>
<!-- Activiti --> <!-- Activiti -->

View File

@@ -2,7 +2,7 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited * Copyright (C) 2005 - 2022 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
@@ -28,6 +28,7 @@ package org.alfresco.ibatis;
import org.alfresco.metrics.db.DBMetricsReporter; import org.alfresco.metrics.db.DBMetricsReporter;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.ibatis.cursor.Cursor;
import org.apache.ibatis.executor.BatchResult; import org.apache.ibatis.executor.BatchResult;
import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultContext; import org.apache.ibatis.session.ResultContext;
@@ -246,6 +247,48 @@ public class SqlSessionMetricsWrapper implements SqlSession
} }
} }
@Override
public <T> Cursor<T> selectCursor(String statement)
{
long startTime = System.currentTimeMillis();
try
{
return this.sqlSession.selectCursor(statement);
}
finally
{
reportQueryExecuted(startTime, SELECT_LABEL, statement);
}
}
@Override
public <T> Cursor<T> selectCursor(String statement, Object parameter)
{
long startTime = System.currentTimeMillis();
try
{
return this.sqlSession.selectCursor(statement, parameter);
}
finally
{
reportQueryExecuted(startTime, SELECT_LABEL, statement);
}
}
@Override
public <T> Cursor<T> selectCursor(String statement, Object parameter, RowBounds rowBounds)
{
long startTime = System.currentTimeMillis();
try
{
return this.sqlSession.selectCursor(statement, parameter, rowBounds);
}
finally
{
reportQueryExecuted(startTime, SELECT_LABEL, statement);
}
}
@Override @Override
public int insert(String statement) public int insert(String statement)
{ {

View File

@@ -49,12 +49,12 @@
<select id="select_Tenant" resultMap="result_Tenant"> <select id="select_Tenant" resultMap="result_Tenant">
select select
tenant_domain as tenantDomain, tenant_domain as tenant_domain,
version as version, version as version,
enabled as enabled, enabled enabled,
tenant_name as tenantName, tenant_name tenant_name,
content_root as contentRoot, content_root content_root,
db_url as dbUrl db_url db_url
from from
alf_tenant alf_tenant
where where
@@ -63,12 +63,12 @@
<select id="select_Tenants" parameterType="TenantQuery" resultMap="result_Tenant"> <select id="select_Tenants" parameterType="TenantQuery" resultMap="result_Tenant">
select select
tenant_domain as tenantDomain, tenant_domain as tenant_domain,
version as version, version as version,
enabled as enabled, enabled as enabled,
tenant_name as tenantName, tenant_name as tenant_name,
content_root as contentRoot, content_root as content_root,
db_url as dbUrl db_url as db_url
from from
alf_tenant alf_tenant
<where> <where>

View File

@@ -15,7 +15,7 @@
</if> </if>
</select> </select>
<select id="select_ChildNodeIds_Limited" parameterType="Ids" resultMap="alfresco.node.result_ChildAssocIds" fetchSize="-2147483648"> <select id="select_ChildNodeIds_Limited" parameterType="ChildAssoc" resultMap="alfresco.node.result_ChildAssocIds" fetchSize="-2147483648">
<include refid="alfresco.node.select_ChildNodeIds_Limited_Snippet"/> <include refid="alfresco.node.select_ChildNodeIds_Limited_Snippet"/>
</select> </select>