[hibernate-dev] Backward compatibility with hibernate 4.1.9
Sanne Grinovero
sanne at hibernate.org
Fri Feb 15 08:30:31 EST 2013
Since it it's a different mayor release, such changes are expected.
We always work hard to maintain backwards compatibility, but occasionally
we need to make significant improvements which will break compatibility:
Hibernate 4.x is significantly different than Hibernate 3.x and such
changes are by design: it is expected that you might have to make
significant changes to your application.
In your specific case I think you should consider removing the usage of
Spring templates, or fork the Spring templates to catch the exceptions you
need, or keep using Hibernate 3.x.
Il giorno 15/feb/2013 12:52, "amit shah" <amits.84 at gmail.com> ha scritto:
>
> I think the defect description was not clear probably. The issue is not
related to backward compatibility of hibernate with other frameworks
(spring in this case). It is with hibernate 4.1.9 vs 3.6.0.
>
> Hibernate 3.6.0 threw checked exceptions (SQLException) while 4.1.9
throws an unchecked exception (SQLGrammerException).
>
>
> On Fri, Feb 15, 2013 at 5:28 PM, Sanne Grinovero <sanne at hibernate.org>
wrote:
>>
>> 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