Skip to content

HibernateTemplate's generic signatures break backwards compatibility at source level [SPR-11402] #16029

@spring-projects-issues

Description

@spring-projects-issues

Bruce Jones opened SPR-11402 and commented

HibernateTemplate method signatures were changed in 4.0.0.Release to better support generics, however the developer involved changed them from List to List<Object>. They should have been changed to List<?> as was done for the methods that return Collection and Iterator.

Example method: org.springframework.orm.hibernate4.HibernateTemplate.findByNamedParam().
Spring 3.2.8 WAS:
public List findByNamedParam(String queryString, String paramName, Object value)
throws DataAccessException {

Spring 4.0.1 IS:
public List<Object> findByNamedParam(String queryString, String paramName, Object value)
throws DataAccessException {

This change will require all client code to be altered which is ironic considering HibernateTemplate itself is basically deprecated and really only exists to give people who use it access to all the bug fixes in 4.X (as per the javadoc). I see absolutely no reason for the new signature and if this change was intended it should have been mentioned in a migration guide?

Is it possible this can be changed before everybody switches their code to the new method signatures as most organisations normally wait 1-2 (n-1) releases until upgrading to a new version.


Affects: 4.0.1

Issue Links:

0 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions