[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1290) EntityQuery.refresh() does not clear parsedEjbql variable
Milli Coelho (JIRA)
jira-events at lists.jboss.org
Mon May 7 23:04:52 EDT 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-1290?page=comments#action_12361727 ]
Milli Coelho commented on JBSEAM-1290:
--------------------------------------
What is the purpose of having the refresh method? Shouldn't I be able to set different query for SubCategoriesList and get a different result list? Or if that is possible without recreating the SubCategoriesList object in the current version please let me know.
You may consider this a feature or a bug but I think it should be given high priority.
> EntityQuery.refresh() does not clear parsedEjbql variable
> ---------------------------------------------------------
>
> Key: JBSEAM-1290
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1290
> Project: JBoss Seam
> Issue Type: Feature Request
> Components: Framework
> Affects Versions: 1.2.1.GA
> Environment: Windows XP/JBoss4.0.5GA/JDK1.6
> Reporter: Milli Coelho
> Priority: Minor
>
> 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