Skip to content

Releases: mybatis/mybatis-dynamic-sql

MyBatis Dynamic SQL Release 1.5.1

30 Apr 19:36
Compare
Choose a tag to compare

This is a minor release with a few enhancements. The most important enhancement is that the library now supports CASE expressions in select statements. The rendering process was also refactored significantly. This should have no impact on most users.

Important: This is the last release that will be compatible with Java 8.

The full list of changes is available here: https://github.com/mybatis/mybatis-dynamic-sql/milestone/13?closed=1

Please find the full release notes here: https://mybatis.org/mybatis-dynamic-sql/docs/CHANGELOG.html

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.5.1</version>
</dependency>

MyBatis Dynamic SQL Release 1.5.0

21 Apr 17:13
Compare
Choose a tag to compare

This release includes many new features and one potential breaking change.

In addition, much of the deprecated code in prior releases was removed.

Potentially Breaking Change

If you create reusable where clauses with the library, and use the WhereSupplier class, the syntax has changed. This change was required when we added support for having clauses (see below). Please see the release notes for full details.

New Features

  • Add support for having clauses. Having clauses have the same syntax and capabilities as where clauses. You can also write standalone having clauses if you have a need to reuse them.
  • Add "multi select" queries - where multiple complete select statements - including order by and limit clauses - can be composed in a union query
  • Add a new "map to row" function in insert, batch insert, and multi-row insert statements that allows you to insert a simple object like Integer or String - or a list of simple objects
  • Several other enhancements detailed in the release notes

The full list of changes is available here: https://github.com/mybatis/mybatis-dynamic-sql/milestone/12?closed=1

Please read the full release notes for details: https://mybatis.org/mybatis-dynamic-sql/docs/CHANGELOG.html#release-1-5-0-april-21-2023

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.5.0</version>
</dependency>

MyBatis Dynamic SQL Release 1.4.1

07 Oct 20:02
Compare
Choose a tag to compare

This maintenance release includes a few new features and one important change.

The next release of the library will be version 1.5.0 and we will remove all deprecated code in that release.

Potentially Breaking Change

The library will now throw a NonRenderingWhereClauseException if a where clause is coded in any statement, but fails to render because all optional conditions have been dropped. We have made this change out of an abundance of caution to prevent statements that accidentally impact all rows in a table (for example, a delete statement could delete all rows in a table).

The default behavior can be modified either through global configuration, or on a statement by statement basis. Please see the documentation page about library configuration for details here: https://mybatis.org/mybatis-dynamic-sql/docs/configuration.html.

New Features

  1. Improve the arbitrary grouping in where clauses - virtually any where clause should now be possible
  2. Add the ability to specify a table alias on delete and update statements - this improves those statements by allowing a correlated sub query
  3. Some minor updates to the Kotlin DSL
  4. Added some checks for invalid SQL
  5. Standardized all exceptions thrown by the library to be either DynamicSqlException or some subclass of DynamicSqlException

The full list of changes is available here: https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.4.1+

Please read the full release notes for details: https://mybatis.org/mybatis-dynamic-sql/docs/CHANGELOG.html

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.4.1</version>
</dependency>

MyBatis Dynamic SQL Release 1.4.0

03 Mar 19:21
Compare
Choose a tag to compare

This release includes the following enhancements:

  1. Add support for arbitrary grouping of conditions in a where clause, and "not" conditions. Any where clause should be possible with this change.
  2. Improvements to table alias calculation that will make sub queries in where clauses easier
  3. Removal of some deprecated code
  4. Major update to Kotlin DSL:
    • The where clause DSL is rewritten and more closely matches native SQL
    • Kotlin where clauses also support arbitrary grouping and "not" conditions
    • All insert statements now have native Kotlin builders
    • Many other small improvements using Kotlin DSL building functions

With this release, the Kotlin DSL is very close to native SQL. It is awesome - give it a try!

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.4.0</version>
</dependency>

MyBatis Dynamic SQL Release 1.3.1

18 Dec 19:11
Compare
Choose a tag to compare

This minor release includes the following enhancements:

  1. Add support for setting a JavaType in an SqlColumn. The type will be rendered properly for MyBatis
  2. Add support for setting a table alias in a new AliasableSqlTable meta-model class
  3. Add a few missing groupBy and orderBy methods on the SELECT statement

The full list of changes is available here: https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.3.1+

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.3.1</version>
</dependency>

MyBatis Dynamic SQL Release 1.3.0

06 May 22:10
Compare
Choose a tag to compare

This release includes the following major enhancements:

  1. Add support for subqueries in select statements
  2. Add support for the "exists" and "not exists" operators in where clauses
  3. Rafactoring and improvement of the built-in conditions including support for chained "filter" and "map" methods
  4. Major improvements to the Kotlin DSL

There are many other minor updates, and deprecated code from prior releases has been removed.

The full list of changes is available here: https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.3.0+

Important Note: This release contains two breaking changes that might impact some users in rare cases. Please read the full release notes for details: https://mybatis.org/mybatis-dynamic-sql/docs/CHANGELOG.html

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.3.0</version>
</dependency>

MyBatis Dynamic SQL Release 1.2.1

30 Sep 00:49
Compare
Choose a tag to compare

This small release contains the following bug fix:

  • Fixed a bug where the "in" conditions could render incorrectly in an unusual corner case

And the following enhancements:

  • Added utility mappers for MyBatis for common CRUD operations. These mappers can be used as-is with MyBatis, or they can be extended and further refined. MyBatis Generator will likely be updated to use these common mappers.
  • Added the ability to add a callback to be executed when an "in" condition is empty at rendering time. Empty "in" conditions will be dropped from the rendered where clause. We also removed the option added last release to force the library to render invalid "in" conditions
  • Refactored the aggregates to use the new base function classes. There is no real difference between an aggregate and a function, and this will allow us to add HAVING support to the select statement in a future release

There are a few other small changes. You can see the full list here: https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.2.1+

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.2.1</version>
</dependency>

MyBatis dynamic SQL Version 1.2.0

19 Aug 15:41
Compare
Choose a tag to compare

This release has a few major themes:

  1. The Kotlin DSL has been improved so that it supports the full capabilities of the underlying Java DSL - most notably in that it now supports union queries.
  2. There are major improvements to the support for Spring NamedParameterJDBCTemplate. In both Java and Kotlin, we now support the full capabilities of the library with Spring. Notable improvements include:
    • All statement types (including multi-row inserts) will render properly and we've added a utility class for Java similar to what was already available in the Kotlin extension methods.
    • We now support retrieval of generated key for most insert statements in Spring, and have added support for generted key retrieval to the Kotlin DSL
    • There is a new capability to convert parameter values before they are placed in a parameter Map. This is similar to a MyBatis type handler, but it is very useful for Spring. It enables you to use more complex types in your model classes, but convert those types to something Spring understands before executing the generated SQL
    • There is a new "general insert" statement that does not require a backing POJO. This can be used for both MyBatis and Spring, but it works very well in Spring in conjunction with the new parameter conversion support
  3. The function base classes have been improved so that it is easier to create your own functions to add capabilities to the library that aren't supported natively.

Several methods - especially some insert methods - have been deprecated in favor of more consistency across all runtimes and languages. All deprecated methods have direct replacements. All deprecated code will be removed in the next release.

There are quite a few other improvements. You can see the full list here: https://github.com/mybatis/mybatis-dynamic-sql/issues?q=milestone%3A1.2.0+

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.2.0</version>
</dependency>

MyBatis dynamic SQL Version 1.1.4

23 Nov 21:08
Compare
Choose a tag to compare

This release has two enhancements:

  1. Add support for sharing where clauses between count, delete, select, and update statements
  2. Improve the Kotlin DSL - removed some extension methods which caused ambiguities and added custom builders

Also fixed one bug:

  1. Fixed bug where uses of limit/offset/fetch first in sub queries would cause a parameter name collision

Detail about these changes can be viewed here:

https://github.com/mybatis/mybatis-dynamic-sql/issues?q=is%3Aclosed+milestone%3A1.1.4

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.1.4</version>
</dependency>

MyBatis dynamic SQL Version 1.1.3

16 Sep 14:49
Compare
Choose a tag to compare

This release has three major enhancements:

  1. Added support for multiple row inserts. This allows you to insert multiple rows in a single statement, rather than having to code a batch. This is useful for a small number of rows, but we still recommend using a batch for a large number of rows. Note that multiple row inserts will not render properly for Spring so they are supported with MyBatis only.
  2. Added utility functions and other changes to allow wider use of lambdas for completing SQL statements. This is particularly noticeable with WHERE clauses - WHERE clauses can now be supplied via lambda rather than by method chaining. Ultimately this will simplify and standardize the code created by MyBatis Generator, but it has benefits in all use cases. As a result of this change, several older methods have been deprecated and will be removed in a future release. There is a corresponding change soon to be released in MyBatis Generator.
  3. Kotlin Support! Another benefit of more fully embracing lambdas is that the new usage patterns start to look a bit more like Kotlin. So we have added a Kotlin DSL and extension methods for both MyBatis and Spring runtimes. This should be considered an initial phase of Kotlin support - there is probably more to come. We would appreciate any feedback from Kotlin users regarding this DSL and what future Kotlin support should look like.

For information about the new lambda based usage pattern, see this page: https://mybatis.org/mybatis-dynamic-sql/docs/mybatis3.html

For information about Kotlin support when using MyBatis, see this page: https://mybatis.org/mybatis-dynamic-sql/docs/kotlinMyBatis3.html

For information about Kotlin support when using Spring JDBC Template, see this page: https://mybatis.org/mybatis-dynamic-sql/docs/kotlinSpring.html

The full list of changes can be viewed here:

https://github.com/mybatis/mybatis-dynamic-sql/issues?q=is%3Aclosed+milestone%3A1.1.3

All artifacts are available in Maven central under these coordinates:

<dependency>
  <groupId>org.mybatis.dynamic-sql</groupId>
  <artifactId>mybatis-dynamic-sql</artifactId>
  <version>1.1.3</version>
</dependency>