Skip to content

Deprecate outdated HibernateTemplate operations in favor of lambdas [SPR-16426] #20972

Closed

Description

@spring-projects-issues

Juergen Hoeller opened SPR-16426 and commented

In anticipation of Hibernate ORM 5.3 (#20850) and for example its removal of legacy positional parameters, let's revisit HibernateTemplate and possibly deprecate affected operations upfront, allowing either for removal in Spring Framework 5.1/5.2 or at least for only supporting them against Hibernate ORM 5.0-5.2 but not 5.3.


Issue Links:

Referenced from: commits 4e194c3

Activity

  1. spring-projects-issues commented on Jan 29, 2018

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    I've marked all parameter-based find operations (as well as iterate and bulkUpdate) as deprecated now since they are all better off with the general HibernateTemplate.execute method and a custom lambda expression against the callback-provided Hibernate Session. Such user-specified code blocks can easily choose the right position index style for their queries then or - preferably - conveniently specify named parameters against org.hibernate.query.Query, avoiding the rather awkward inline parameter approach in HibernateTemplate.findByNamedParam, in particular now that we are on Java 8+.

    I've also documented that such deprecated operations are known to work against Hibernate ORM 5.0-5.2 but may not work against Hibernate ORM 5.3 anymore (in particular when using positional parameters). We'll keep them around for use of Spring Framework 5.x against Hibernate ORM 5.0-5.2 but won't upgrade them any further. Existing applications are adviced to upgrade to Hibernate ORM 5.2.x for the time being, planning for 5.3 as a larger upgrade where the application's query operations might have to be revisited.

  2. added
    in: data
    type: task
    on Jan 11, 2019
  3. added this to the 5.0.4 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: datatype: task

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions