Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-1159

HibernateTemplate query methods that support UserTypes

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Spring has no way of knowing what Hibernate Types to use in HibernateQueries, so if you attempt to use any of the find* methods in the template, and you are using a Hibernate UserType/CustomType(s) as query parameters, Spring/Hibernate will not be able to guess the type correctly.

      It took me a while to figure out that you need to use a HibernateCallback to call the hibernate Query.setParamater(name, value, Type)

      I would suggest adding some methods to the HibernateTemplate that support UserTypes, like..

      findByNamedQuery(String queryName, Object value, org.hibernate.type.Type type)

      findByNamedQuery(String queryName, Object[] values, org.hibernate.type.Type[] types)

      Let me know if you would like me to submit a patch..

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            ticktock Scott Clasen
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 37 weeks ago