[hibernate-dev] Backward compatibility with hibernate 4.1.9

Sanne Grinovero sanne at hibernate.org
Fri Feb 15 06:58:30 EST 2013


Hi Amit,
please use the developer list for such concerns, which I've added in CC.

Personally I don't think your issue is valid, but I'll leave that to
the other team members to decide.
We never promised backwards compatibility with other frameworks when
upgrading from Hibernate 3 to 4, it is likely that you will need to
make some adjustments in configurations; also I'm not a Spring expert
but from what you describe it looks to me it's not a good idea to use
the "spring jdbc template" as JDBC and Hibernate are two different
things.

Sanne

On 15 February 2013 11:41, amit shah <amits.84 at gmail.com> wrote:
> Hello Steve/Sanne,
>                While upgrading to hibernate 4.1.9 from 3.6.0 I am facing an
> blocking issue for which I would appreciate if you can provide your inputs.
> The issue was logged on jira forum but it didn't get much attention. I will
> paste it here once.  Kindly let me know your thoughts.
>
>
> Description
>
> I upgraded my project with hibernate 4.1.9 and spring 3.2.1 and noticed that
> hibernate throws RuntimeExceptions instead of checked exception in the
> earlier version (3.6.0 final was the one we used earlier). The code use case
> is as below.
>
> We use spring jdbc template for executing jdbc queries and the application
> is configured to use JPA (JPATransactionManager and JPADialect) for mapped
> entities. When executing a query which could throw a exception for e.g. a
> select query on a table that does not exist, hibernate now proxies the jdbc
> statements and throws a SQLGrammerException (extends RuntimeException)
> instead of a checked exception - SQLException.
>
> Since spring catch's SQLException, the code no longer executes the catch
> block and fails with an exception.
>
> Attached a sample java program to reproduce the issue. Please execute the
> main method of the ExceptionHandlingTask class. It starts a spring
> transaction and executes a query on a non existing table.
>
> Spring and hibernate jars must be included in the classpath.
>
> Thank you,
> Amit.


More information about the hibernate-dev mailing list