[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1290) EntityQuery.refresh() does not clear parsedEjbql variable

Milli Coelho (JIRA) jira-events at lists.jboss.org
Thu May 3 15:19:40 EDT 2007


EntityQuery.refresh() does not clear parsedEjbql variable
---------------------------------------------------------

                 Key: JBSEAM-1290
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1290
             Project: JBoss Seam
          Issue Type: Bug
          Components: Framework
    Affects Versions: 1.2.1.GA
         Environment: Windows XP/JBoss4.0.5GA/JDK1.6
            Reporter: Milli Coelho


I'm using the seam-gen generated class SubcategoriesList which is derived from EntityQuery and modified it to accept any query passed by a calling object as below:

public class SubCategoriesList extends EntityQuery {


   private SubCategories subCategories = new SubCategories();
    private String query;
    private Integer maxResults;
    
    public SubCategoriesList()
    {
        query = "select subCategories from SubCategories subCategories";
        this.maxResults = 25;
    }
    
	@Override
	public String getEjbql() {
		return query;
	}

	@Override
	public Integer getMaxResults() {
		return this.maxResults;
	}

	public SubCategories getSubCategories() {
		return subCategories;
	}

	@Override
	public List<String> getRestrictions() {
		return Arrays.asList(RESTRICTIONS);
	}

    public List<SubCategories> forCategory(String categoryId)
    {
       query = "select subCategories from SubCategories subCategories where subCategories.categories.id = " + Integer.parseInt(categoryId);
       return  getResultList();       
    }
   
}

In my calling object, I instantiate this class and use the method forCategory to get the list of subcategories for a given category id. If I reuse the object after calling refresh() and pass a different category id, it gives the same resultlist.  After looking in EntityQuery and Query classes, I see refresh() does not nullify parsedEjbql and therefore createQuery() uses the same query everytime to get the resultlist.


-- 
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

        



More information about the seam-issues mailing list