Class StatementConfiguration
java.lang.Object
org.mybatis.dynamic.sql.configuration.StatementConfiguration
This class can be used to change some behaviors of the framework. Every configurable statement
contains a unique instance of this class, so changes here will only impact a single statement.
If you intend to change the behavior for all statements, use the
GlobalConfiguration
.
Initial values for this class in each statement are set from the GlobalConfiguration
.
Configurable behaviors are detailed below:
- emptyListConditionRenderingAllowed
- If false (default), the framework will not render list conditions that are empty in a where clause. This is beneficial in that it will not allow the library to generate invalid SQL, but it has a potentially dangerous side effect where a statement could be generated that impacts more rows then expected. If true, an empty list will be rendered as "in ()", "not in ()", etc. which will likely cause an SQLException at runtime.
- nonRenderingWhereClauseAllowed
- If false (default), the framework will throw a
NonRenderingWhereClauseException
if a where clause is specified in the statement, but it fails to render because all optional conditions do not render. For example, if an "in" condition specifies an empty list of values. If no criteria are specified in a where clause, the framework assumes that no where clause was intended and will not throw an exception.
- Since:
- 1.4.1
- Author:
- Jeff Butler
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
setEmptyListConditionRenderingAllowed
(boolean emptyListConditionRenderingAllowed) setNonRenderingWhereClauseAllowed
(boolean nonRenderingWhereClauseAllowed)
-
Constructor Details
-
StatementConfiguration
public StatementConfiguration()
-
-
Method Details
-
isNonRenderingWhereClauseAllowed
public boolean isNonRenderingWhereClauseAllowed() -
setNonRenderingWhereClauseAllowed
public StatementConfiguration setNonRenderingWhereClauseAllowed(boolean nonRenderingWhereClauseAllowed) -
isEmptyListConditionRenderingAllowed
public boolean isEmptyListConditionRenderingAllowed() -
setEmptyListConditionRenderingAllowed
public StatementConfiguration setEmptyListConditionRenderingAllowed(boolean emptyListConditionRenderingAllowed)
-