diff --git a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryUtils.java b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryUtils.java index 396e46f112..f269c00710 100644 --- a/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryUtils.java +++ b/org.springframework.orm/src/main/java/org/springframework/orm/hibernate3/SessionFactoryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -625,16 +625,21 @@ public abstract class SessionFactoryUtils { return new DataAccessResourceFailureException(ex.getMessage(), ex); } if (ex instanceof SQLGrammarException) { - return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex); + SQLGrammarException jdbcEx = (SQLGrammarException) ex; + return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex); } if (ex instanceof LockAcquisitionException) { - return new CannotAcquireLockException(ex.getMessage(), ex); + LockAcquisitionException jdbcEx = (LockAcquisitionException) ex; + return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex); } if (ex instanceof ConstraintViolationException) { - return new DataIntegrityViolationException(ex.getMessage(), ex); + ConstraintViolationException jdbcEx = (ConstraintViolationException) ex; + return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + + "]; constraint [" + jdbcEx.getConstraintName() + "]", ex); } if (ex instanceof DataException) { - return new DataIntegrityViolationException(ex.getMessage(), ex); + DataException jdbcEx = (DataException) ex; + return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex); } if (ex instanceof JDBCException) { return new HibernateJdbcException((JDBCException) ex);