Re: performQuery generics

From: Aristedes Maniatis (ar..sh.com.au)
Date: Fri Dec 21 2007 - 07:38:20 EST

  • Next message: Andrus Adamchik: "Re: performQuery generics"

    On 21/12/2007, at 8:41 PM, Tore Halset wrote:

    > Hello.
    >
    > I typically do a lot of
    >
    > SelectQuery query = new SelectQuery(MyEntity.class, qual);
    > List entities = ctxt.performQuery(query);
    >
    > What I want instead is something like
    >
    > SelectQuery<MyEntity> query = new SelectQuery<MyEntity>(qual);
    > List<MyEntity> entities = ctxt.performQuery(query);
    >
    > How can I get rid of the "MyEntity.class, " argument to the
    > SelectQuery constructor?
    > What about SelectQuery#setFetchingDataRows that changes the expected
    > return type?
    > What do you think?

    How will the query know which table to perform the query on? I think
    that passing the table is essential. But having two separate methods,
    one of which returns data rows and one which return persistent objects
    will help tremendously.

    Also, is reversing the syntax an interesting idea if this change is
    going to be made?

    List<Artists> result = query.getResult(Artist.class, context);
    List<Artists> result = query.getResultAsDataRows(Artist.class, context);

    Maybe that will just confuse people. Otherwise,

    context.getResultAsDataRows(Artist.class, query)
    context.getResult(Artist.class, query)

    Ari

    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A



    This archive was generated by hypermail 2.0.0 : Fri Dec 21 2007 - 07:39:01 EST