SpringUtils formatHibernateQueryParameterValue for Enumerations

Description

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

Environment

Windows 7 / MySql

Activity

Show:
Bob Fields
April 28, 2011, 5:02 AM

Fix applied on 4/27/2011

Assignee

Former user

Reporter

Andy Flury

Labels

None

Time tracking

1h

Components

Fix versions

Affects versions

Priority

Minor
Configure