1 /*
2 * Copyright 2016-2025 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.mybatis.dynamic.sql.exception;
17
18 import java.io.Serial;
19
20 import org.mybatis.dynamic.sql.configuration.GlobalConfiguration;
21 import org.mybatis.dynamic.sql.configuration.StatementConfiguration;
22 import org.mybatis.dynamic.sql.util.Messages;
23
24 /**
25 * This exception is thrown when the where clause in a statement will not render.
26 * This can happen if all the optional conditions in a where clause fail to
27 * render - for example, if an "in" condition specifies an empty list.
28 *
29 * <p>By default, the framework will throw this exception if a where clause
30 * fails to render. A where clause that fails to render can be very dangerous in that
31 * it could cause all rows in a table to be affected by a statement - for example,
32 * all rows could be deleted.
33 *
34 * <p>If you intend to allow a where clause to not render, then configure the
35 * statement to allow it, or change the global configuration.
36 *
37 * @see GlobalConfiguration
38 * @see StatementConfiguration
39 *
40 * @since 1.4.1
41 *
42 * @author Jeff Butler
43 */
44 public class NonRenderingWhereClauseException extends DynamicSqlException {
45 @Serial
46 private static final long serialVersionUID = 6619119078542625135L;
47
48 public NonRenderingWhereClauseException() {
49 super(Messages.getString("ERROR.2")); //$NON-NLS-1$
50 }
51 }