Sometimes, static SQL queries may not be sufficient for application requirements. We may have to build queries dynamically, based on some criteria.
For example, in web applications there could be search screens that provide one or more input options and perform searches based on the chosen criteria. While implementing this kind of search functionality, we may need to build a dynamic query based on the selected options. If the user provides any value for input criteria, we'll need to add that field in the
WHERE clause of the query.
MyBatis provides first-class support for building dynamic SQL queries using elements such as
can be used to conditionally embed ...