Hi all,

I've been debugging the SEAM source code and I found a solution I would like to 
share with you. It requires modification in the SEAM source code, but it fix 
the bug in EntityQuery.

in org.jboss.seam.framework.Query:

include this new method:

   protected String getCountEjbqlWithRestrictions() {
  |     String hql = getCountEjbql();
  | 
  |     StringBuilder builder = new StringBuilder().append(hql);
  | 
  |     for (int i = 0; i < getRestrictions().size(); i++) {
  |             Object parameterValue = getRestrictionParameters().get(i)
  |                             .getValue();
  |             if (isRestrictionParameterSet(parameterValue)) {
  |                     if (WHERE_PATTERN.matcher(builder).find()) {
  |                             builder.append(" and ");
  |                     } else {
  |                             builder.append(" where ");
  |                     }
  |                     builder.append(parsedRestrictions.get(i));
  |             }
  |     }
  |     return builder.toString();
  |    }

in org.jboss.seam.framework.EntityQuery:

in method createCountQuery() (around line 167), change the line

javax.persistence.Query query = getEntityManager().createQuery( getCountEjbql() 
);

to this

javax.persistence.Query query = getEntityManager().createQuery( 
getCountEjbqlWithRestrictions() );

It would be nice if it were permanently implemented in the SEAM source code (or 
something similar to fix the present problem). 

Regards,
Ricardo




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083075#4083075

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083075
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to