Skip to content

Commit 0e07986

Browse files
committed
Merge branch 'master' into gh/566-oracle-nested-cursor
2 parents 1df5aaf + 1b2346c commit 0e07986

21 files changed

+94
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
/release.properties
1111
/target
1212
.github/keys/
13+
.profiler/
1314

1415
# These are needed if running in IDE without properties set
1516
/ibderby

.mvn/extensions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
1818
-->
1919
<extensions>
20+
<!-- Usage as -Dprofile -->
2021
<extension>
2122
<groupId>fr.jcgay.maven</groupId>
2223
<artifactId>maven-profiler</artifactId>

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ Please use [the mailing list](https://groups.google.com/group/mybatis-user) inst
1212
- It is a good idea to discuss your changes on [the mailing list](https://groups.google.com/group/mybatis-user) to get feedback from the community.
1313
- If you have a patch with unit tests, send a pull request. Please see the [Contributing code](CONTRIBUTING.md#contributing-code) section.
1414

15-
1615
## Improving documentation
1716

1817
- Documentations are placed under [src/site](https://github.com/mybatis/mybatis-3/tree/master/src/site) directory in [the xdoc format](https://maven.apache.org/doxia/references/xdoc-format.html), so it is basically the same as creating a patch to contribute documentation changes. Please see the [Contributing code](CONTRIBUTING.md#contributing-code) section.
1918

2019
## Contributing code
2120

21+
### Formatting
22+
23+
Mybatis-core is now being auto formatted. Given nature of some code logic with mybatis, it is more appropriate to force a formatting structure manually for snippets such as sql statements. To do so, add following blocks around code.
24+
25+
- ```// @formatter:off``` to start the block of unformatted code
26+
- ```// @formatter:on``` to end the block of unformatted code
27+
28+
If comment sections need same behaviour such as javadocs, note that the entire block must be around entire comment as direct usage does not properly indicate that formatter treats it all as one comment block regardless.
29+
2230
### Copyright and License
2331

2432
- You are the author of your contributions and will always be.

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ MyBatis SQL Mapper Framework for Java
33

44
[![build](https://github.com/mybatis/mybatis-3/actions/workflows/ci.yaml/badge.svg)](https://github.com/mybatis/mybatis-3/actions?query=workflow%3A%22Java+CI%22)
55
[![Coverage Status](https://coveralls.io/repos/mybatis/mybatis-3/badge.svg?branch=master&service=github)](https://coveralls.io/github/mybatis/mybatis-3?branch=master)
6+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mybatis_mybatis-3&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=mybatis_mybatis-3)
67
[![Maven central](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mybatis/mybatis)
78
[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.mybatis/mybatis.svg)](https://oss.sonatype.org/content/repositories/snapshots/org/mybatis/mybatis/)
89
[![License](https://img.shields.io/:license-apache-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
@@ -25,12 +26,7 @@ Essentials
2526
Contributions
2627
-------------
2728

28-
Mybatis-core is now being auto formatted. Given nature of some code logic with mybatis, it is more appropriate to force a formatting structure manually for snippets such as sql statements. To do so, add following blocks around code.
29-
30-
- ```// @formatter:off``` to start the block of unformatted code
31-
- ```// @formatter:on``` to end the block of unformatted code
32-
33-
If comment sections need same behaviour such as javadocs, note that the entire block must be around entire comment as direct usage does not properly indicate that formatter treats it all as one comment block regardless.
29+
See [here](CONTRIBUTING.md)
3430

3531
Tests
3632
-----

hooks/pre-commit.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2009-2025 the original author or authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
set -eo pipefail
18+
19+
function format_and_sort() {
20+
# Run the validate and import check commands, suppressing all output and errors
21+
if ! mvn formatter:validate impsort:check > /dev/null 2>&1; then
22+
# If validation failed, fix it by ensuring code is formatted correctly
23+
# and that imports are sorted as some IDEs automatically change it on save
24+
mvn formatter:format impsort:sort
25+
26+
# Fail the commit, so the author can re-select what to commit
27+
echo "Formatting and/or import sorting were required. Please check and make another commit."
28+
exit 1
29+
fi
30+
31+
# If no error occurred, print a success message
32+
echo "All files are properly formatted and imports are sorted."
33+
}
34+
35+
format_and_sort

pom.xml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@
7272

7373
<clirr.comparisonVersion>3.4.6</clirr.comparisonVersion>
7474

75-
<byte-buddy.version>1.15.11</byte-buddy.version>
75+
<byte-buddy.version>1.16.1</byte-buddy.version>
7676
<derby.version>10.17.1.0</derby.version>
7777
<log4j.version>2.24.3</log4j.version>
7878
<mockito.version>5.15.2</mockito.version>
7979
<mssql-jdbc.version>12.8.1.jre11</mssql-jdbc.version>
8080
<testcontainers.version>1.20.4</testcontainers.version>
81+
<git-build-hook.version>3.5.0</git-build-hook.version>
8182

8283
<!-- Add slow test groups here and annotate classes similar to @Tag('groupName'). -->
8384
<!-- Excluded groups are ran on github ci, to force here, pass -d"excludedGroups=" -->
@@ -195,13 +196,13 @@
195196
<dependency>
196197
<groupId>org.postgresql</groupId>
197198
<artifactId>postgresql</artifactId>
198-
<version>42.7.4</version>
199+
<version>42.7.5</version>
199200
<scope>test</scope>
200201
</dependency>
201202
<dependency>
202203
<groupId>com.mysql</groupId>
203204
<artifactId>mysql-connector-j</artifactId>
204-
<version>9.1.0</version>
205+
<version>9.2.0</version>
205206
<scope>test</scope>
206207
</dependency>
207208
<dependency>
@@ -213,7 +214,7 @@
213214
<dependency>
214215
<groupId>org.assertj</groupId>
215216
<artifactId>assertj-core</artifactId>
216-
<version>3.27.2</version>
217+
<version>3.27.3</version>
217218
<scope>test</scope>
218219
</dependency>
219220
<dependency>
@@ -431,6 +432,24 @@
431432
</rules>
432433
</configuration>
433434
</plugin>
435+
436+
<plugin>
437+
<groupId>com.rudikershaw.gitbuildhook</groupId>
438+
<artifactId>git-build-hook-maven-plugin</artifactId>
439+
<version>${git-build-hook.version}</version>
440+
<configuration>
441+
<installHooks>
442+
<pre-commit>hooks/pre-commit.sh</pre-commit>
443+
</installHooks>
444+
</configuration>
445+
<executions>
446+
<execution>
447+
<goals>
448+
<goal>install</goal>
449+
</goals>
450+
</execution>
451+
</executions>
452+
</plugin>
434453
</plugins>
435454
</build>
436455

src/test/java/org/apache/ibatis/binding/BindingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ void shouldCacheMapperMethod() throws Exception {
623623
void shouldGetBlogsWithAuthorsAndPosts() {
624624
try (SqlSession session = sqlSessionFactory.openSession()) {
625625
BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class);
626-
List<Blog> blogs = mapper.selectBlogsWithAutorAndPosts();
626+
List<Blog> blogs = mapper.selectBlogsWithAuthorAndPosts();
627627
assertEquals(2, blogs.size());
628628
assertTrue(blogs.get(0) instanceof Proxy);
629629
assertEquals(101, blogs.get(0).getAuthor().getId());
@@ -640,7 +640,7 @@ void shouldGetBlogsWithAuthorsAndPosts() {
640640
void shouldGetBlogsWithAuthorsAndPostsEagerly() {
641641
try (SqlSession session = sqlSessionFactory.openSession()) {
642642
BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class);
643-
List<Blog> blogs = mapper.selectBlogsWithAutorAndPostsEagerly();
643+
List<Blog> blogs = mapper.selectBlogsWithAuthorAndPostsEagerly();
644644
assertEquals(2, blogs.size());
645645
assertFalse(blogs.get(0) instanceof Factory);
646646
assertEquals(101, blogs.get(0).getAuthor().getId());

src/test/java/org/apache/ibatis/binding/BoundBlogMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Blog selectBlogWithAParamNamedValue(@Param("column") String column, @Param("id")
251251
@Result(property = "posts", column = "id", many = @Many(select = "selectPostsById"))
252252
})
253253
// @formatter:on
254-
List<Blog> selectBlogsWithAutorAndPosts();
254+
List<Blog> selectBlogsWithAuthorAndPosts();
255255

256256
// @formatter:off
257257
@Select({
@@ -263,6 +263,6 @@ Blog selectBlogWithAParamNamedValue(@Param("column") String column, @Param("id")
263263
@Result(property = "posts", column = "id", many = @Many(select = "selectPostsById", fetchType = FetchType.EAGER))
264264
})
265265
// @formatter:on
266-
List<Blog> selectBlogsWithAutorAndPostsEagerly();
266+
List<Blog> selectBlogsWithAuthorAndPostsEagerly();
267267

268268
}

src/test/java/org/apache/ibatis/executor/loader/CglibProxyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void shouldLetCallALoadedProperty() {
7171
}
7272

7373
@Test
74-
void shouldSerizalizeADeserlizaliedProxy() throws Exception {
74+
void shouldSerializeADeserializedProxy() throws Exception {
7575
Object proxy = ((CglibProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<>(),
7676
new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
7777
Author author2 = (Author) deserialize(serialize((Serializable) proxy));

src/test/java/org/apache/ibatis/executor/loader/JavassistProxyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void shouldLetCallALoadedProperty() {
6969
}
7070

7171
@Test
72-
void shouldSerizalizeADeserlizaliedProxy() throws Exception {
72+
void shouldSerializeADeserializedProxy() throws Exception {
7373
Object proxy = ((JavassistProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<>(),
7474
new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
7575
Author author2 = (Author) deserialize(serialize((Serializable) proxy));

0 commit comments

Comments
 (0)