Skip to content

Instantly share code, notes, and snippets.

View harawata's full-sized avatar

Iwao AVE! harawata

View GitHub Profile

MyBatis 3.5.3 の日本語版リリースノートです。

新機能・改善点:

  • <sql /> の CDATA に含まれる変数が置換されるようになりました。#1615
  • JDK 14+8 以降の環境でデフォルトメソッドを呼び出せるようになりました。 #1626
  • Java マッパーのデフォルトメソッド呼び出し時に illegal reflective access の警告が出ないように変更しました。 #1636
  • JavaBean 仕様に従わない getter/setter は、実際に呼び出された場合にのみ ReflectionException を投げるようになりました。 #1201

不具合修正:

@harawata
harawata / mybatis-3.5.2-release-note-ja.md
Created July 14, 2019 14:03
MyBatis 3.5.2 日本語版リリースノート

MyBatis 3.5.2 の日本語版リリースノートです。

新機能・改善点:

  • SQL ビルダーに LIMIT, OFFSET #1521 および FETCH FIRST #1582 のサポートが追加されました。
  • SQL ビルダーが複数行の INSERT 文に対応しました。 #1333
  • PooledDataSource および UnpooledDataSource に新プロパティ defaultNetworkTimeout が追加されました。 #1527
  • 各 SQL プロバイダ・アノテーションでプロバイダ・クラスを指定する際、type だけでなく value でも指定できるようになりました。 #1522
  • ArrayTypeHandler#setNonNullParameter() に Java の配列を渡せるようになりました。 #1548
  • OGNL 式の中で、@Param 指定のない単独引数を任意の名前で参照できるようになりました。 #1487
@harawata
harawata / mybatis-3.5.1-release-note-ja.md
Last active April 8, 2019 15:36
MyBatis 3.5.1 日本語版リリースノート

MyBatis 3.5.1 の日本語版リリースノートです。

不具合修正:

  • 引数名を含んだ keyProperty を指定すると ExecutorException が発生する場合がある。 #1485
  • 正しい result map に対して 'Ambiguous collection type ...' というエラーが発生する場合がある。 #1472
  • メソッド定義を持つ enum に対して EnumTypeHandler が適用されない。 #1489
  • <arg />, <idArg />resultMapcolumnPrefix が両方指定されていると、参照された result map で auto-mapping が正しく適用されない。 #1496
  • 親の result map で columnPrefix が指定されているとコンストラクタ auto-mapping が正しく適用されない。 #1495
  • LocalTimeTypeHandler でナノ秒のデータが保持されない。 #1478
@harawata
harawata / JdbcConnection.java
Last active January 11, 2019 17:58
JDBC test program to check if conversion between java.sql.OffsetTime and TIMESTAMP WITH TIME ZONE is supported
/**
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@harawata
harawata / OffsetDateTimeTest.java
Last active October 14, 2018 17:11
JDBC app that INSERT/SELECT OffsetDateTime using PreparedStatement#setObject() and ResultSet#getObject()
import java.sql.*;
import java.time.*;
import java.util.*;
public class OffsetDateTimeTest {
public static void main(String[] args) throws Exception {
try (Connection con = new JdbcConnection(args[0]).getConnection()) {
try (Statement stmt = con.createStatement()) {
try {
stmt.execute("drop table test");
/**
* Copyright 2009-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
import java.sql.*;
import java.util.*;
import java.nio.file.*;
public class SqlServerSelect {
public static void main(String[] args) throws Exception {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url = "jdbc:sqlserver://192.168.227.139:1433;databaseName=ADMIOT_BI_1207";
String username = "sa";
@harawata
harawata / ConcurrentGetValue.java
Last active November 2, 2019 08:46
Demo app trying to reproduce https://github.com/mybatis/mybatis-3/issues/1648 but to no avail.
import ognl.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.*;
public class ConcurrentGetValue {
public static void main(String[] args) {
int size = Integer.valueOf(args[0]);
final Person p = new Person();
@harawata
harawata / AddAliasToBaseColumnListPlugin.java
Created April 1, 2016 16:39
An example mybatis generator plugin that appends ${alias} to Base_Column_List
import java.util.List;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.xml.TextElement;
import org.mybatis.generator.api.dom.xml.XmlElement;
public class AddAliasToBaseColumnListPlugin extends PluginAdapter {
public boolean validate(List<String> arg0) {
return true;
diff --git a/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java b/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
index afcb1ff..bfbe785 100644
--- a/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
+++ b/src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java
@@ -314,7 +314,7 @@ public class DefaultResultSetHandler implements ResultSetHandler {
throws SQLException {
DefaultResultContext<Object> resultContext = new DefaultResultContext<Object>();
skipRows(rsw.getResultSet(), rowBounds);
- while (shouldProcessMoreRows(resultContext, rowBounds) && rsw.getResultSet().next()) {
+ while (shouldProcessMoreRows(resultContext, rowBounds) && !rsw.getResultSet().isClosed() && rsw.getResultSet().next()) {