MyBatis Changelog

What's new in MyBatis 3.5.16

Apr 19, 2024
  • Security:
  • Prevent Invocation from being used by vulnerable applications. #3115
  • Bugs:
  • When database ID resolution is failed, invalid bound statement is used. #3040
  • Enhancements:
  • It is now possible to write a custom map wrapper to customize how to map column name with dots or brackets. #13 #3062
  • Performance:
  • Improved compatibility with Virtual Threads introduced by Loom.
  • Reduced memory footprint when performing the default (i.e. order based) constructor auto-mapping. #3113
  • Build:
  • Include the shaded libraries (OGNL and Javassist) in the sources.jar.

New in MyBatis 3.5.14 (Nov 6, 2023)

  • Bug fixes:
  • Registered type handler is not used for anonymous enums #2956
  • Discriminator does not work in constructor mapping #2913

New in MyBatis 3.5.13 (Mar 13, 2023)

  • Bug fix:
  • Unable to resolve result type when the target property has a getter with different return type #2834

New in MyBatis 3.5.11 (Sep 18, 2022)

  • Doc: update Chinese translation for configuration.xml
  • Update dependency ognl:ognl to v3.3.4
  • [modernize] Use standard charsets
  • ReturnInstanceForEmptyRow does not work for constructor auto-mapping
  • Update dependency org.javassist:javassist to v3.29.1-GA
  • Modify the resultMaps example property (ko, ja, es)
  • Added a missing single quote in an exception message
  • Translate into Korean. (configuration, dynamic-sql, sqlmap-xml)
  • Helpful error message when using multiple @AutomapConstructor with argNameBasedConstructorAutoMapping setting
  • Bump ognl from 3.3.2 to 3.3.3
  • MyBatis can't decide wich method to use after upgrade from 3.5.9 -> 3.5.10
  • PooledDataSource : replace synchronized block with ReentrantLock
  • Remove redundant null check in Configuration#newExecutor()
  • Remove redundant null check in Configuration#newExecutor()
  • Added getter for additionalParameters

New in MyBatis 3.5.10 (May 24, 2022)

  • Bug fixes:
  • Unexpected illegal reflective access warning (or InaccessibleObjectException on Java 16+) when calling method in OGNL expression. #2392
  • IllegalAccessException when auto-mapping Records (JEP-359) #2195
  • 'interrupted' status is not set when PooledConnection#getConnection() is interrupted. #2503
  • Enhancements:
  • A new option argNameBasedConstructorAutoMapping is added. If enabled, constructor argument names are used to look up columns when auto-mapping. #2192
  • Added a new property skipSetAutoCommitOnClose to JdbcTransactionFactory. Skipping setAutoCommit() call could improve performance with some drivers. #2426
  • <idArg /> can now be listed after <arg /> in <constructor />. #2541

New in MyBatis 3.5.9 (Dec 26, 2021)

  • List of changes:
  • Add nullable to <collection />. If enabled, it skips the iteration when the collection is null instead of throwing an exception. To enable this feature globally, set nullableOnForEach=true in the config. #1883
  • We also updated the version of Log4J dependency to 2.17.0.

New in MyBatis 3.5.8 (Dec 13, 2021)

  • List of changes:
  • Avoid NullPointerException when mapping an empty string to java.lang.Character. #2368
  • Fixed an incorrect argument when initializing static object. This resolves a compatibility issue with quarkus-mybatis. #2284
  • Performance improvements. #2297 #2335 #2340
  • And many doc updates!

New in MyBatis 3.5.7 (Apr 27, 2021)

  • Bug fixes:
  • Improved performance under JDK 8. #2223

New in MyBatis 3.5.6 (Oct 6, 2020)

  • Enhancements:
  • A new configuration option defaultSqlProviderType is added. The specified class will be used as the SQL provider when the value() or type() is not specified in @SelectProvider, @UpdateProvider, @InsertProvider and @DeleteProvider. #1951
  • A new transaction isolation level SQL_SERVER_SNAPSHOT is added to TransactionIsolationLevel enum to support the MS SQL Server specific isolation level SNAPSHOT. #1973
  • When there is no JEP-290 serialization filter defined, a WARN level message is logged on deserializing object streams. #2079
  • Bug fixes:
  • Possible NoSuchPropertyException under heavy load. #1648
  • Possible InvalidPathException when registering type aliases by specifying package name. #1974
  • Possible OutOfMemoryError when using BlockingCache. #2044
  • There is no known backward incompatible change since 3.5.5.

New in MyBatis 3.5.5 (Jun 4, 2020)

  • Enhancements:
  • You can reference single List or Collection type parameter using its actual parameter name when useActualParamName is enabled. #1237
  • You can specify resultMap in @One and @Many. #1771
  • You can specify columnPrefix in @One and @Many. #1829
  • A new option shrinkWhitespacesInSql to remove extra whitespaces in SQL. #1901
  • Bug fixes:
  • Possible IllegalArgumentException when using @CacheNamespaceRef . #1719
  • Mapper method invocation should be non-blocking (work around JDK-8161372). #1929
  • There is no known backward incompatible change since 3.5.4.

New in MyBatis 3.5.4 (Feb 4, 2020)

  • Enhancements:
  • You can now omit unnecessary @Results and @ConstructorArgs annotation. #1698
  • Bug fixes:
  • Avoid invoking hashCode() method when setting auto-generated keys. #1719
  • Possible ResultMapException when using nested select. #1551
  • Possible incorrect TypeVariable resolution in TypeParameterResolver. #1794
  • Race condition in TypeHandlerRegistry. #1819

New in MyBatis 3.5.3 (Oct 20, 2019)

  • Enhancements:
  • Support variable substitution in CDATA of included <sql />. #1615
  • Support default method invocation on JDK 14+8 or later. #1626
  • Avoid illegal reflective access warning when invoking default mapper method. #1636
  • Ambiguous getter/setter now throws ReflectionException only when it is actually accessed. #1201
  • Bug fixes:
  • Possible infinite loop when a SQL provider throws an exception. #1616
  • Unable to iterate Cursor if the next element is null. #1653
  • queryCursor() fails in streaming mode of MySQL Connector/J. #1654

New in MyBatis 3.5.2 (Jul 15, 2019)

  • Enhancements:
  • SQL builder now supports LIMIT, OFFSET #1521 and FETCH FIRST #1582.
  • SQL builder now supports multi-row insert syntax #1333.
  • A new property defaultNetworkTimeout has been added to the built-in data sources i.e. PooledDataSource and UnpooledDataSource #1527.
  • SQL provider annotations now takes value attribute which is an alias for type #1522.
  • You can now pass Java array to ArrayTypeHandler#setNonNullParameter() #1548.
  • You can reference single simple type unnamed parameter with any name in OGNL expressions #1487.
  • A new configuration option defaultResultSetType is added #1056.
  • Bugs:
  • SQL provider method with a primitive parameter causes BuilderException #1604.
  • Fixes a possible NullPointerException #1590.

New in MyBatis 3.5.1 (Apr 7, 2019)

  • Bug fixes:
  • KeyProperty specified with parameter name could cause ExecutorException. #1485
  • False positive error 'Ambiguous collection type ...' . #1472
  • EnumTypeHandler is not used when the enum has methods. #1489
  • Auto-mapping fails in a result map referenced from a constructor arg with columnPrefix. #1496
  • Constructor auto-mapping could fail when columnPrefix is specified in the parent result map. #1495
  • LocalTimeTypeHandler loses fractional seconds part. #1478
  • LocalDateTypeHandler and LocalDateTimeTypeHandler could return unexpected value. #1478
  • Enhancements:
  • You can now return 'script' from a SQL provider. The returned script is parsed using the language driver specified by @Lang. #1391
  • You can now omit method attribute from SQL provider annotations when the provider method has the same name as the mapper method or its name is provideSql. #1279
  • You can now get databaseId in SQL providers. #1503
  • The default type handler for LONGVARCHAR is changed from ClobTypeHandler to StringTypeHandler. This improves compatibility with SAP ASE. #1484
  • There is a backward incompatible change:
  • Because of the fix for #1478 , LocalDateTypeHandler, LocalTimeTypeHandler and LocalDateTimeTypeHandler now require a JDBC driver that supports JDBC 4.2 API.

New in MyBatis 3.4.6 (Mar 12, 2018)

  • Enhancements:
  • Apply custom ResultHandler to CURSOR type OUT parameter. #493
  • Substitute variables in attribute values of included SQL fragments. #1069
  • BatchExecutor now closes each statement immediately after execution. #1110
  • It is now possible to use a static method as SQL provider. #1131
  • SQL provider method can now return CharSequence instead of String. #1134
  • Add resource path to the exception message when parsing XML mapper failed. #1172
  • Bug fixes:
  • Registering type handler against HashMap causes ClassCastException. #1089
  • Unable to register TypeHandler once TypeHandlerRegistry.hasTypeHandler is called. #1177
  • Serializing and deserializing cached objects causes NullPointerException. #1084
  • Invalid error message 'Two methods with same method signature but not providing classes assignable?' in System.err. #929

New in MyBatis 3.4.5 (Mar 12, 2018)

  • Enhancements:
  • Make default enum type handler customizable. #971
  • Make mapper method and its interface type accessible to SqlProvider. #1055
  • Allow using configuration properties in SqlProvider. #1061
  • Merge type handlers for JSR-310 (Java Date and Time API) into the core. #974
  • Bug fixes:
  • The type handler registered for a common interface of enums was not applied correctly. #976
  • Lazy loading should not overwrite a property value set by user. #988
  • Prevent foreach xml tag from polluting the global context. #966
  • Some parameter names (e.g. 'size') can cause ClassCastException. #1031
  • Not all result sets are processed when UPDATE or INSERT is performed in between. #1036
  • With PostgreSQL, ExecutorException is thrown if useGeneratedKeys is enabled globally. #902

New in MyBatis 3.4.3 (Mar 12, 2018)

  • Enhancements:
  • Allow registering a type handler for a common interface of enums. #947
  • Share Jdbc3KeyGenerator and NoKeyGenerator instances #882
  • Building UPDATE JOIN statement by SQL Builder #903
  • Bug fixes:
  • Failed to find a statement mapped to a super interface #481
  • Default methods support on mappers, does not work for non-public mappers. #905
  • foreignColumns with multiple columns validation error #526
  • Fix wrong registration logic for LanguageDriver #914
  • A boolean property should be able to have two getters: isX() and getX() #906
  • Possible unexpected auto-mapping #895
  • Excessive memory allocation for primitive arrays in nested resultmaps #927

New in MyBatis 3.4.2 (Mar 12, 2018)

  • Here is a list of major enhancements in MyBatis 3.4.2:
  • New option 'returnInstanceForEmptyRow' to control the behavior when a query returns a row with all columuns being null. #800
  • Support 'default methods' on mapper interfaces. #709
  • When no type handler is registered to a class, a type handler registered to its superclass can be used. #859
  • New attributes properties is added to @CacheNamespace. #841
  • New attributes name is added to @CacheNamespaceRef. #842
  • Support the mechanism for initializing a cache after set all properties. #816
  • Allow users to set default value in placeholders. #852
  • Auto-detecting type handlers newly added in version 1.0.2 of TypeHandlers-JSR310. #727 #878
  • Although it may be rare, the following changes could affect existing solutions:
  • The default value of aggressiveLazyLoading is changed to false. #825
  • Raise a exception when keyProperty is not found. #782

New in MyBatis 3.4.1 (Mar 12, 2018)

  • This release includes four user visible enhancements:
  • Allow referencing parameters by their declared names when compiled with Java 8 -parameters option. #549
  • Added auto-detection of Year/MonthTypeHandler added in mybatis-typehandlers-jsr310 1.0.1. #646
  • @Select can now return an array of objects. #669
  • Allow specifying custom reflectorFactory in XML config. #657
  • And six bug fixes:
  • Circularly referenced resultMap was filled with ancestor object even when columnPrefix was specified. #215
  • Select statement with @Param couldn't be used as a nested select statement of association. #649
  • RuntimeException was thrown at the startup on IBM WebSphere Application Server 8.5.5.9. #706
  • Couldn't use Cursor as the return type of @Select statements. #661
  • Couldn't use RowBounds as a parameter of select statement whose return type is Cursor. #667
  • NullPointerException was thrown when used with Kylin JDBC driver. #699

New in MyBatis 3.4.0 (Mar 12, 2018)

  • MyBatis 3.4.0 with the following main features:
  • New Cursor List method in SqlSession.
  • Inherit Spring timeout in transactions.
  • Better support for generic types.
  • Out-of-the-box support new Date and Time API (JSR-310) classes added in Java 8.
  • Note that there are changes that may break existing code:
  • New method getTimeout() in the Transaction interface. If you implemented your own transaction adapter you will need to implement this method at least with a "return null"
  • @options( flushCache ) now takes enum values (DEFAULT/TRUE/FALSE) instead of boolean.
  • StatementHandler#prepare(Connection) has been changed to StatementHandler#prepare(Connection,Integer) given that now it gets the transaction timeout.

New in MyBatis 3.3.0 Snapshot (Jun 30, 2014)

  • OGNL upgraded to 3.0.8
  • Javassist is now the default Proxy provider (bundled inside mybatis.jar)

New in MyBatis 3.2.7 (Jun 30, 2014)

  • This release is a hotfix to solve the bug reported in #167 that broke the @One annotation in 3.