mybatis-dynamic-sql

SQL DSL (Domain Specific Language) for Kotlin and Java. Supports rendering for MyBatis or Spring JDBC Templates

APACHE-2.0 License

Stars
1.1K
Committers
18

Bot releases are visible (Hide)

mybatis-dynamic-sql - MyBatis Dynamic SQL Release 1.5.2 Latest Release

Published by jeffgbutler 5 months ago

This is a small maintenance release with the following changes:

  1. Improvements to the Kotlin DSL for CASE expressions (infix methods for "else" and "then"). See this PR for
    details: #785
  2. Potentially Breaking Change: the "in" conditions ("isIn", "isNotIn", "isInCaseInsensitive",
    "isNotInCaseInsensitive") will now render if the input list of values is empty. This will lead
    to a runtime exception. This change was made out of an abundance of caution and is the safest choice.
    If you wish to allow "in" conditions to be removed from where clauses when the list is empty,
    then use the "when present" versions of those conditions. If you are unsure how this works, please
    read the documentation here: https://mybatis.org/mybatis-dynamic-sql/docs/conditions.html#optionality-with-the-%E2%80%9Cin%E2%80%9D-conditions
    For background on the reason for the change, see the discussion in issue #788

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/14?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.2</version>
</dependency>
mybatis-dynamic-sql - MyBatis Dynamic SQL Release 1.5.1

Published by jeffgbutler 6 months ago

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 - MyBatis Dynamic SQL Release 1.5.0

Published by jeffgbutler over 1 year ago

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 - MyBatis Dynamic SQL Release 1.4.1

Published by jeffgbutler about 2 years ago

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 - MyBatis Dynamic SQL Release 1.4.0

Published by jeffgbutler over 2 years ago

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 - MyBatis Dynamic SQL Release 1.3.1

Published by jeffgbutler almost 3 years ago

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 - MyBatis Dynamic SQL Release 1.3.0

Published by jeffgbutler over 3 years ago

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 - MyBatis Dynamic SQL Release 1.2.1

Published by jeffgbutler about 4 years ago

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 - MyBatis dynamic SQL Version 1.2.0

Published by jeffgbutler about 4 years ago

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 - MyBatis dynamic SQL Version 1.1.4

Published by jeffgbutler almost 5 years ago

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 - MyBatis dynamic SQL Version 1.1.3

Published by jeffgbutler about 5 years ago

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>
mybatis-dynamic-sql - MyBatis Dynamic SQL 1.1.2

Published by jeffgbutler over 5 years ago

This release includes several enhancements related to increasing user flexibility including:

  1. Database catalogs and schemas can now be supplied at runtime. The enables code to be responsive to different environments, or enabling certain types of sharding
  2. The public API for List based conditions has been changed to support Collection instead of List
  3. The library now supports "fetch first" based paging in addition to "limit and offset". We believe "fetch first" is more standard and supported by more databases.
  4. Many enhancements related to supporting more complex query scenarios (see below)

By far, the most important enhancements are related to making it easier to create very dynamic select statements with complex where clauses. There is a new page in the online documentation showing the new capabilities here: http://www.mybatis.org/mybatis-dynamic-sql/docs/complexQueries.html

The full list of changes can be viewed here:

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

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.2</version>
</dependency>
mybatis-dynamic-sql - MyBatis Dynamic SQL 1.1.1

Published by jeffgbutler over 5 years ago

This release includes many enhancements and one small bug fix.

The most important enhancements are as follows:

  1. Added support for limit and offset to the select statement. This support will only work if the underlying database supports limit and offset so use with caution. Many databases do support limit and offset.
  2. Added utility classes to support MyBatis Spring Batch integration. See this page for details: http://www.mybatis.org/mybatis-dynamic-sql/docs/springBatch.html
  3. Added much more robust support for optional conditions. All conditions can now be optionally rendered with lambdas - so users can have complete control over how conditions get rendered into the final SQL. See this page for details: http://www.mybatis.org/mybatis-dynamic-sql/docs/conditions.html

The full list of changes can be viewed here:

https://github.com/mybatis/mybatis-dynamic-sql/issues?q=is%3Aclosed+milestone%3A1.1.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.1.1</version>
</dependency>
mybatis-dynamic-sql - MyBatis Dynamic SQL 1.1.0

Published by jeffgbutler over 6 years ago

This release includes many enhancements and two bug fixes.

The most important enhancement is the introduction of optional conditionals. They allow a where clause to be created that varies based on the value of the input parameters. See the following page for details and examples:

http://www.mybatis.org/mybatis-dynamic-sql/docs/conditions.html

The full list of changes can be viewed here:

https://github.com/mybatis/mybatis-dynamic-sql/issues?q=is%3Aclosed+milestone%3A1.1.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.1.0</version>
</dependency>
mybatis-dynamic-sql - MyBatis Dynamic SQL 1.0.0

Published by jeffgbutler almost 7 years ago

First release of MyBatis Dynamic SQL - an SQL generator/templating utility for MyBatis and Spring JDBC templates.

Available in maven central here:

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