Hi
I'm using hibernate filters on some entities but get a IllegalArgumentException: incorrect type for parameter
when i try to inject a
List of Integers
into my seam managed filter i components.xml.
In my case I am using an In operator as filter condition and wants to inject a List of parameters. Hibernate supports that using the
setParameterList method.
I did some debugging and found that setParameter is the only method being called is the enableFilter method on HibernatePersistenceProvider.
I think this is a bug an should test whether it should call setParameterList or setParameter.
I'm able to fix this with a workaround and manual enabling the filter and setting the parameters.
....
@Override
public void enableFilter(Filter f, EntityManager entityManager)
{
try
{
org.hibernate.Filter filter = getSession(entityManager).enableFilter( f.getName() );
for ( Map.Entry<String, ValueExpression> me: f.getParameters().entrySet() )
{
filter.setParameter( me.getKey(), me.getValue().getValue() );
}
filter.validate();
}
catch (NotHibernateException nhe)
{
super.enableFilter(f, entityManager);
}
}