[
http://jira.jboss.com/jira/browse/JBSEAM-2987?page=comments#action_12418049 ]
Scott Olcott commented on JBSEAM-2987:
--------------------------------------
in HibernateEntityQuery the private setParameters method the following needs to be changed
from
if ( isRestrictionParameterSet(parameterValue) )
{
query.setParameter( QueryParser.getParameterName(start + i), parameterValue );
}
to
if (isRestrictionParameterSet(parameterValue)) {
// This fixes a bug in Seam where Collection objects cannot be parameters in
restrictions.
if (parameterValue instanceof Collection) {
query.setParameterList(QueryParser.getParameterName(start + i), (Collection)
parameterValue);
}
else {
query.setParameter(QueryParser.getParameterName(start + i), parameterValue);
}
}
It looks like the method was just copied from EntityQuery. JPA takes care of the
Collection parameter for you.
HibernateEntityQuery fails when using a Collection as a parameter in
an restriction
-----------------------------------------------------------------------------------
Key: JBSEAM-2987
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2987
Project: Seam
Issue Type: Bug
Components: Framework
Affects Versions: 2.1.0.A1, 2.0.2.CR2
Environment: hibernate/tomcat
Reporter: Scott Olcott
Fix For: 2.1.0.BETA1
HibernateEntityQuery fails when using a Collection object as a parameter in an
restriction.
The private setParameters method in HibernateEntityQuery does not check to see if the
parameter is a Collection before calling query.setParameter(name,value). In plain
hibernate it needs to call the query.setParameterList method instead of the setParameter
method. When passing a List as a parameter to a restriction a ClassCastException is
thrown.
This is not an issue when using EntityQuery, because in JPA the setParameter method on
org.hibernate.ejb.QueryImpl takes care of this for you.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira