[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-2008) Query should use parameterized type for results

Dan Allen (JIRA) jira-events at lists.jboss.org
Thu Oct 4 22:32:21 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-2008?page=all ]

Dan Allen updated JBSEAM-2008:
------------------------------

    Component/s: Core
                     (was: Tools)

> Query should use parameterized type for results
> -----------------------------------------------
>
>                 Key: JBSEAM-2008
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2008
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>    Affects Versions: 2.0.0.CR1
>            Reporter: Dan Allen
>         Assigned To: Dan Allen
>            Priority: Minor
>             Fix For: 2.0.1.GA
>
>         Attachments: JBSEAM-2008-v1.txt
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> I don't see any reason why Query cannot be defined as Query<T, E> rather than Query<T>. The general design of Query is that it operates on a static base query (only the conditions are dynamic). Therefore, the item type in the result list should be anticipated. In any case, if it is not, you can always define it using the generic type Object.
> To cite an example, we start with:
> public class EntityQuery<E> extends Query<EntityManager, E> {}
> We can use it as:
> public class CategoryQuery extends EntityQuery<Category> {
> }
> CategoryQuery q = new CategoryQuery();
> for ( Category c : q.getResultList() ) {
>   // didn't need to cast!
> }
> On the other hand, if the query component is defined without the type, it will still work. The type will be treated as java.lang.Object.
> public class CategoryQuery extends EntityQuery {
> }

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