001/*
002 * Copyright 2002-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.dao;
018
019import org.springframework.core.NestedRuntimeException;
020import org.springframework.lang.Nullable;
021
022/**
023 * Root of the hierarchy of data access exceptions discussed in
024 * <a href="https://www.amazon.com/exec/obidos/tg/detail/-/0764543857/">Expert One-On-One J2EE Design and Development</a>.
025 * Please see Chapter 9 of this book for detailed discussion of the
026 * motivation for this package.
027 *
028 * <p>This exception hierarchy aims to let user code find and handle the
029 * kind of error encountered without knowing the details of the particular
030 * data access API in use (e.g. JDBC). Thus it is possible to react to an
031 * optimistic locking failure without knowing that JDBC is being used.
032 *
033 * <p>As this class is a runtime exception, there is no need for user code
034 * to catch it or subclasses if any error is to be considered fatal
035 * (the usual case).
036 *
037 * @author Rod Johnson
038 */
039@SuppressWarnings("serial")
040public abstract class DataAccessException extends NestedRuntimeException {
041
042        /**
043         * Constructor for DataAccessException.
044         * @param msg the detail message
045         */
046        public DataAccessException(String msg) {
047                super(msg);
048        }
049
050        /**
051         * Constructor for DataAccessException.
052         * @param msg the detail message
053         * @param cause the root cause (usually from using a underlying
054         * data access API such as JDBC)
055         */
056        public DataAccessException(@Nullable String msg, @Nullable Throwable cause) {
057                super(msg, cause);
058        }
059
060}