Cayenne
  1. Cayenne
  2. CAY-1686

StringIdQuery - a query providing an optimized fetch for objects based on 1..N String IDs.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1B1
    • Fix Version/s: 3.1B1
    • Component/s: Lifecycle Extensions
    • Labels:
      None

      Description

      We need a query that can provide an optimized fetch for objects based on 1..N String IDs.

      In my projects I have a bunch of APIs that would provide me a with collection of String IDs that I'd like to convert to a collection of target objects across whatever many tables. Been doing that manually till now. Would be cool to encapsualte this operation in a query. BTW we have a prototype of such query already - org.apache.cayenne.lifecycle.relationship.ObjectIdBatchFault

        Activity

        Andrus Adamchik created issue -
        Hide
        Andrus Adamchik added a comment -

        Done. An annoying limitation is that just like QueryChain, this query can only return DataRows in a general case, as Cayenne runtime can only convert the first list in QueryResponse to objects, but here we may get many lists. A really arbitrary limitation IMO. Anyways, this can be used like this:

        QueryResponse response = runtime.getContext().performGenericQuery(query);
        while (response.next())

        { List<DataRow> list = (List<DataRow>) response.currentList(); // do something, e.g. convert this to a list of Persistent objects }
        Show
        Andrus Adamchik added a comment - Done. An annoying limitation is that just like QueryChain, this query can only return DataRows in a general case, as Cayenne runtime can only convert the first list in QueryResponse to objects, but here we may get many lists. A really arbitrary limitation IMO. Anyways, this can be used like this: QueryResponse response = runtime.getContext().performGenericQuery(query); while (response.next()) { List<DataRow> list = (List<DataRow>) response.currentList(); // do something, e.g. convert this to a list of Persistent objects }
        Andrus Adamchik made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 3.1M4 [ 12317958 ]
        Resolution Fixed [ 1 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        21h 33m 1 Andrus Adamchik 13/Mar/12 19:20

          People

          • Assignee:
            Andrus Adamchik
            Reporter:
            Andrus Adamchik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development