[jboss-user] [JBoss Seam] - Re: EntityQuery bug
rmemoria
do-not-reply at jboss.com
Tue Sep 11 11:08:11 EDT 2007
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
More information about the jboss-user
mailing list