/*
 * Copyright 2002-2006 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.orm.hibernate3;

import org.hibernate.JDBCException;

import org.springframework.dao.UncategorizedDataAccessException;

/**
 * Hibernate-specific subclass of UncategorizedDataAccessException,
 * for JDBC exceptions that Hibernate rethrew.
 *
 * @author Juergen Hoeller
 * @since 1.2
 * @see SessionFactoryUtils#convertHibernateAccessException
 */
public class HibernateJdbcException extends UncategorizedDataAccessException {

	public HibernateJdbcException(JDBCException ex) {
		super("JDBC exception on Hibernate data access", ex);
	}

}

@@ -21,9 +21,9 @@
 -200
-6
+7
  the
@@ -660,16 +660,47 @@
 nate3;%0A%0A
+import java.sql.SQLException;%0A%0A
 import o
@@ -908,15 +908,15 @@
 ate 
-rethrew
+wrapped
 .%0A *
@@ -1204,13 +1204,443 @@
 cess
-%22, ex
+: SQLException for SQL %5B%22 + ex.getSQL() + %22%5D; SQL state %5B%22 +%0A%09%09%09%09ex.getSQLState() + %22%5D; error code %5B%22 + ex.getErrorCode() + %22%5D; %22 + ex.getMessage(), ex);%0A%09%7D%0A%0A%09/**%0A%09 * Return the underlying SQLException.%0A%09 */%0A%09public SQLException getSQLException() %7B%0A%09%09return ((JDBCException) getCause()).getSQLException();%0A%09%7D%0A%0A%09/**%0A%09 * Return the SQL that led to the problem.%0A%09 */%0A%09public String getSql() %7B%0A%09%09return ((JDBCException) getCause()).getSQL(
 );%0A%09

extract the SQL statement and explicitly build it into the exception message