SpringUtils formatHibernateQueryParameterValue for Enumerations
---------------------------------------------------------------

                 Key: SPRING-218
                 URL: http://jira.andromda.org/browse/SPRING-218
             Project: Spring Cartridge
          Issue Type: Bug
    Affects Versions: 3.4
         Environment: Windows 7 / MySql
            Reporter: Andy flury
            Assignee: Chad Brandon
            Priority: Minor
         Attachments: SpringUtils.java.patch

Hi

There is a problem with SpringUtils.formatHibernateQueryParameterValue(). For 
Enumerations this method returns: 

param.getValue()

Template SpringHibernateDaoBase.vsl will therefore output the following inside 
the Finder Method:

Query queryObject = super.getSession(false).createQuery(queryString);   
queryObject.setParameter("parameter", parameter.getValue());

This gives a problem with the HibernateEnumType, where the parameter is handed 
to the method disassemble as a "String" and not as an "Enum", which will raise 
the following error:

Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Enum
        at 
org.andromda.persistence.hibernate.usertypes.HibernateEnumType.disassemble(HibernateEnumType.java:52)

Within SpringUtils.formatHibernateQueryParameterValue the case about 
Enumerations should be removed

I have attached a patch for this

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev

Reply via email to