1. /*
  2. * Copyright 2002-2004 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. * http://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.springframework.jdbc;
  17. import java.sql.SQLWarning;
  18. import org.springframework.dao.UncategorizedDataAccessException;
  19. /**
  20. * Exception thrown when we're not ignoring warnings.
  21. *
  22. * <p>If such an exception is thrown, the operation completed,
  23. * so we will need to explicitly roll it back if we're not happy
  24. * on looking at the warning. We might choose to ignore (or merely log)
  25. * the warning and throw the exception away.
  26. *
  27. * @author Rod Johnson
  28. */
  29. public class SQLWarningException extends UncategorizedDataAccessException {
  30. /**
  31. * Constructor for ConnectionFactoryException.
  32. * @param msg message
  33. * @param ex JDBC warning
  34. */
  35. public SQLWarningException(String msg, SQLWarning ex) {
  36. super(msg, ex);
  37. }
  38. /**
  39. * Return the SQLWarning.
  40. */
  41. public SQLWarning SQLWarning() {
  42. return (SQLWarning) getCause();
  43. }
  44. }