Skip to content

Commit f2a4a09

Browse files
committed
Merge branch 'master' into feature-transaction-test
# Conflicts: # src/test/java/org/apache/ibatis/scripting/xmltags/ChooseSqlNodeTest.java # src/test/java/org/apache/ibatis/scripting/xmltags/ForEachSqlNodeTest.java # src/test/java/org/apache/ibatis/scripting/xmltags/MixedSqlNodeTest.java
2 parents 067b46a + 266542a commit f2a4a09

File tree

53 files changed

+1018
-360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1018
-360
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
matrix:
1010
cache: [maven]
1111
distribution: [temurin]
12-
java: [17, 21, 22, 23-ea, 24-ea]
12+
java: [17, 21, 23, 24-ea, 25-ea]
1313
os: [ubuntu-latest, macos-latest, windows-latest]
1414
fail-fast: false
1515
max-parallel: 4

.github/workflows/site.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build:
10-
if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
10+
if: github.repository_owner == 'mybatis' && contains(toJSON(github.event.head_commit.message), '[maven-release-plugin] prepare release')
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4

pom.xml

Lines changed: 36 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@
1717
1818
-->
1919
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
2021
<modelVersion>4.0.0</modelVersion>
2122

2223
<parent>
2324
<groupId>org.mybatis</groupId>
2425
<artifactId>mybatis-parent</artifactId>
25-
<version>45</version>
26+
<version>48</version>
2627
<relativePath />
2728
</parent>
2829

2930
<groupId>org.mybatis</groupId>
3031
<artifactId>mybatis</artifactId>
31-
<version>3.5.17-SNAPSHOT</version>
32+
<version>3.5.18-SNAPSHOT</version>
3233

3334
<name>mybatis</name>
3435
<description>The MyBatis SQL mapper framework makes it easier to use a relational database with object-oriented
@@ -39,73 +40,6 @@
3940

4041
<inceptionYear>2009</inceptionYear>
4142

42-
<contributors>
43-
<contributor>
44-
<name>Adam Gent</name>
45-
<email>[email protected]</email>
46-
</contributor>
47-
<contributor>
48-
<name>Andrea Selva</name>
49-
<email>[email protected]</email>
50-
</contributor>
51-
<contributor>
52-
<name>Antonio Sánchez</name>
53-
<email>[email protected]</email>
54-
</contributor>
55-
<contributor>
56-
<name>Arkadi Shishlov</name>
57-
<email>[email protected]</email>
58-
</contributor>
59-
<contributor>
60-
<name>Axel Doerfler</name>
61-
<email>[email protected]</email>
62-
</contributor>
63-
<contributor>
64-
<name>Chris Dadej</name>
65-
<email>[email protected]</email>
66-
</contributor>
67-
<contributor>
68-
<name>Denis Vygovskiy</name>
69-
<email>[email protected]</email>
70-
</contributor>
71-
<contributor>
72-
<name>Franta Mejta</name>
73-
<email>[email protected]</email>
74-
</contributor>
75-
<contributor>
76-
<name>Jurriaan Pruys</name>
77-
<email>[email protected]</email>
78-
</contributor>
79-
<contributor>
80-
<name>Keith Wong</name>
81-
<email>[email protected]</email>
82-
</contributor>
83-
<contributor>
84-
<name>Lasse Voss</name>
85-
<email>[email protected]</email>
86-
</contributor>
87-
<contributor>
88-
<name>Luke Stevens</name>
89-
<email>[email protected]</email>
90-
</contributor>
91-
<contributor>
92-
<name>Paul Krause</name>
93-
<email>[email protected]</email>
94-
</contributor>
95-
<contributor>
96-
<name>Peter Leibiger</name>
97-
<email>[email protected]</email>
98-
</contributor>
99-
<contributor>
100-
<name>Riccardo Cossu</name>
101-
<email>[email protected]</email>
102-
</contributor>
103-
<contributor>
104-
<name>Tomáš Neuberg</name>
105-
<email>[email protected]</email>
106-
</contributor>
107-
</contributors>
108-
10943
<scm>
11044
<connection>scm:git:ssh://[email protected]/mybatis/mybatis-3.git</connection>
11145
<developerConnection>scm:git:ssh://[email protected]/mybatis/mybatis-3.git</developerConnection>
@@ -129,14 +63,21 @@
12963
</distributionManagement>
13064

13165
<properties>
66+
<!-- Java Usage -->
67+
<java.version>8</java.version>
68+
<java.release.version>8</java.release.version>
69+
70+
<!-- Override impsort comliance to 17 (remove after parent 49 release) -->
71+
<impsort.compliance>17</impsort.compliance>
72+
13273
<clirr.comparisonVersion>3.4.6</clirr.comparisonVersion>
13374

134-
<byte-buddy.version>1.15.4</byte-buddy.version>
75+
<byte-buddy.version>1.15.11</byte-buddy.version>
13576
<derby.version>10.17.1.0</derby.version>
136-
<log4j.version>2.24.1</log4j.version>
77+
<log4j.version>2.24.3</log4j.version>
13778
<mockito.version>5.14.2</mockito.version>
13879
<mssql-jdbc.version>12.8.1.jre11</mssql-jdbc.version>
139-
<testcontainers.version>1.20.2</testcontainers.version>
80+
<testcontainers.version>1.20.4</testcontainers.version>
14081

14182
<!-- Add slow test groups here and annotate classes similar to @Tag('groupName'). -->
14283
<!-- Excluded groups are ran on github ci, to force here, pass -d"excludedGroups=" -->
@@ -157,14 +98,14 @@
15798
<argLine>-Xmx2048m -javaagent:${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar</argLine>
15899

159100
<!-- Reproducible Builds -->
160-
<project.build.outputTimestamp>1712079482</project.build.outputTimestamp>
101+
<project.build.outputTimestamp>1732629483</project.build.outputTimestamp>
161102
</properties>
162103

163104
<dependencies>
164105
<dependency>
165106
<groupId>ognl</groupId>
166107
<artifactId>ognl</artifactId>
167-
<version>3.4.3</version>
108+
<version>3.4.4</version>
168109
<scope>compile</scope>
169110
<optional>true</optional>
170111
</dependency>
@@ -186,19 +127,19 @@
186127
<dependency>
187128
<groupId>org.junit.jupiter</groupId>
188129
<artifactId>junit-jupiter-engine</artifactId>
189-
<version>5.11.2</version>
130+
<version>5.11.4</version>
190131
<scope>test</scope>
191132
</dependency>
192133
<dependency>
193134
<groupId>org.junit.jupiter</groupId>
194135
<artifactId>junit-jupiter-params</artifactId>
195-
<version>5.11.2</version>
136+
<version>5.11.4</version>
196137
<scope>test</scope>
197138
</dependency>
198139
<dependency>
199140
<groupId>org.hsqldb</groupId>
200141
<artifactId>hsqldb</artifactId>
201-
<version>2.7.3</version>
142+
<version>2.7.4</version>
202143
<scope>test</scope>
203144
</dependency>
204145
<dependency>
@@ -246,7 +187,7 @@
246187
<dependency>
247188
<groupId>org.apache.velocity</groupId>
248189
<artifactId>velocity-engine-core</artifactId>
249-
<version>2.4</version>
190+
<version>2.4.1</version>
250191
<scope>test</scope>
251192
</dependency>
252193
<!-- postgresql driver is required to run the refcursor tests -->
@@ -265,7 +206,7 @@
265206
<dependency>
266207
<groupId>org.assertj</groupId>
267208
<artifactId>assertj-core</artifactId>
268-
<version>3.26.3</version>
209+
<version>3.27.0</version>
269210
<scope>test</scope>
270211
</dependency>
271212
<dependency>
@@ -316,7 +257,7 @@
316257
<dependency>
317258
<groupId>ch.qos.reload4j</groupId>
318259
<artifactId>reload4j</artifactId>
319-
<version>1.2.25</version>
260+
<version>1.2.26</version>
320261
<optional>true</optional>
321262
</dependency>
322263
<dependency>
@@ -342,7 +283,7 @@
342283
<dependency>
343284
<groupId>ch.qos.logback</groupId>
344285
<artifactId>logback-classic</artifactId>
345-
<version>1.5.11</version>
286+
<version>1.5.15</version>
346287
<scope>test</scope>
347288
</dependency>
348289
<dependency>
@@ -455,55 +396,31 @@
455396
</excludes>
456397
</configuration>
457398
</plugin>
399+
400+
<!-- Remove enforcer entirely after parent 49 release -->
401+
<plugin>
402+
<groupId>org.apache.maven.plugins</groupId>
403+
<artifactId>maven-enforcer-plugin</artifactId>
404+
<configuration>
405+
<rules>
406+
<enforceBytecodeVersion>
407+
<maxJdkVersion>${java.version}</maxJdkVersion>
408+
<ignoredScopes>provided,test</ignoredScopes>
409+
</enforceBytecodeVersion>
410+
</rules>
411+
</configuration>
412+
</plugin>
458413
</plugins>
459414
</build>
460415

461416
<profiles>
462-
<profile>
463-
<id>pre16</id>
464-
<activation>
465-
<jdk>(,16)</jdk>
466-
</activation>
467-
<properties>
468-
<derby.version>10.15.2.0</derby.version>
469-
<mssql-jdbc.version>12.4.2.jre8</mssql-jdbc.version>
470-
</properties>
471-
<build>
472-
<pluginManagement>
473-
<plugins>
474-
<plugin>
475-
<groupId>org.apache.maven.plugins</groupId>
476-
<artifactId>maven-compiler-plugin</artifactId>
477-
<configuration>
478-
<testExcludes>
479-
<testExclude>**/record_type/*.java</testExclude>
480-
</testExcludes>
481-
</configuration>
482-
</plugin>
483-
<plugin>
484-
<groupId>net.revelc.code</groupId>
485-
<artifactId>impsort-maven-plugin</artifactId>
486-
<configuration>
487-
<skip>true</skip>
488-
</configuration>
489-
</plugin>
490-
</plugins>
491-
</pluginManagement>
492-
</build>
493-
</profile>
494417
<profile>
495418
<id>16</id>
496419
<activation>
497420
<jdk>[16,)</jdk>
498421
</activation>
499422
<properties>
500-
<derby.version>10.15.2.0</derby.version>
501-
<java.version>16</java.version>
502-
<java.release.version>16</java.release.version>
503-
<java.test.version>16</java.test.version>
504-
<java.test.release.version>16</java.test.release.version>
505423
<excludedGroups>TestcontainersTests,RequireIllegalAccess</excludedGroups>
506-
<allowed.build.jdks>[11,12),[17,18),[21,22),[22,23),[23,24),[24,25)</allowed.build.jdks>
507424
</properties>
508425
</profile>
509426
<profile>

src/main/java/org/apache/ibatis/annotations/Select.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* public interface UserMapper {
4545
* @Select({ "<script>", "select * from users", "where name = #{name}",
4646
* "<if test=\"age != null\"> age = #{age} </if>", "</script>" })
47-
* User select(@NotNull String name, @Nullable Intger age);
47+
* User select(@NotNull String name, @Nullable Integer age);
4848
* }
4949
* }</pre>
5050
*

src/main/java/org/apache/ibatis/builder/annotation/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2022 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,6 +14,6 @@
1414
* limitations under the License.
1515
*/
1616
/**
17-
* Parses annotions to create a Configuration.
17+
* Parses annotations to create a Configuration.
1818
*/
1919
package org.apache.ibatis.builder.annotation;

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,13 @@ private Object applyConstructorAutomapping(ResultSetWrapper rsw, ResultMap resul
783783
private boolean applyColumnOrderBasedConstructorAutomapping(ResultSetWrapper rsw, List<Class<?>> constructorArgTypes,
784784
List<Object> constructorArgs, Constructor<?> constructor, boolean foundValues) throws SQLException {
785785
Class<?>[] parameterTypes = constructor.getParameterTypes();
786+
787+
if (parameterTypes.length > rsw.getClassNames().size()) {
788+
throw new ExecutorException(MessageFormat.format(
789+
"Constructor auto-mapping of ''{0}'' failed. The constructor takes ''{1}'' arguments, but there are only ''{2}'' columns in the result set.",
790+
constructor, parameterTypes.length, rsw.getClassNames().size()));
791+
}
792+
786793
for (int i = 0; i < parameterTypes.length; i++) {
787794
Class<?> parameterType = parameterTypes[i];
788795
String columnName = rsw.getColumnNames().get(i);

src/main/java/org/apache/ibatis/logging/jdbc/BaseJdbcLogger.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ protected String objectValueString(Object value) {
102102
try {
103103
return ArrayUtil.toString(((Array) value).getArray());
104104
} catch (SQLException e) {
105-
// Intentialy fall through to return value.toString()
105+
// Intentionally fall through to return value.toString()
106106
}
107107
}
108108
return value.toString();

src/main/java/org/apache/ibatis/mapping/VendorDatabaseIdProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,11 +55,11 @@ public void setProperties(Properties p) {
5555

5656
private String getDatabaseName(DataSource dataSource) throws SQLException {
5757
String productName = getDatabaseProductName(dataSource);
58-
if (this.properties != null) {
59-
return properties.entrySet().stream().filter(entry -> productName.contains((String) entry.getKey()))
60-
.map(entry -> (String) entry.getValue()).findFirst().orElse(null);
58+
if (properties == null || properties.isEmpty()) {
59+
return productName;
6160
}
62-
return productName;
61+
return properties.entrySet().stream().filter(entry -> productName.contains((String) entry.getKey()))
62+
.map(entry -> (String) entry.getValue()).findFirst().orElse(null);
6363
}
6464

6565
private String getDatabaseProductName(DataSource dataSource) throws SQLException {

src/main/java/org/apache/ibatis/type/DateOnlyTypeHandler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ public void setNonNullParameter(PreparedStatement ps, int i, Date parameter, Jdb
3333

3434
@Override
3535
public Date getNullableResult(ResultSet rs, String columnName) throws SQLException {
36-
return toSqlDate(rs.getDate(columnName));
36+
return toDate(rs.getDate(columnName));
3737
}
3838

3939
@Override
4040
public Date getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
41-
return toSqlDate(rs.getDate(columnIndex));
41+
return toDate(rs.getDate(columnIndex));
4242
}
4343

4444
@Override
4545
public Date getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
46-
return toSqlDate(cs.getDate(columnIndex));
46+
return toDate(cs.getDate(columnIndex));
4747
}
4848

49-
private java.sql.Date toSqlDate(Date date) {
50-
return date == null ? null : new java.sql.Date(date.getTime());
49+
private Date toDate(java.sql.Date date) {
50+
return date == null ? null : new Date(date.getTime());
5151
}
5252

5353
}

0 commit comments

Comments
 (0)