FAQ
Hello !

I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
SQLTemplate query to do an UPDATE.
The thing is i would like to know how many rows are updated, and the
query returns no DataRows.

SQLTemplate query = new SQLTemplate(..., "UPDATE...");
query.setFetchingDataRows(true);

List<DataRow> dtList = context.performQuery(query);

the returned list is always empty....
How can i get the precious Integer saying "X rows updated" ?

Thanks.
Laurent Marchal.

Search Discussions

  • Michael Shea at Sep 11, 2008 at 4:00 pm
    int[] updateCounts = context.performNonSelectingQuery( query );

    =).

    Mike Shea.
    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.
  • Andrus Adamchik at Sep 11, 2008 at 4:02 pm
    Hi,

    You need to use a different DataContext method
    List<DataRow> dtList = context.performQuery(query);
    Should be

    int[] updateCounts = context.performNonSelectingQuery(query);

    now if you are referencing ObjectContext throughout the code (hiding
    DataContext implementation), there is an even more generic method:

    QueryResponse result = context.performGenericQuery(query);
    int[] updateCounts = result.firstUpdateCount();


    The two examples above are doing the same exact thing.

    Andrus

    On Sep 11, 2008, at 6:53 PM, Laurent Marchal wrote:

    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.

  • Laurent Marchal at Sep 15, 2008 at 9:23 am
    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.
  • Andrus Adamchik at Sep 15, 2008 at 9:46 am
    Is this a dupe? This already got answered here:

    http://markmail.org/message/v7ioxwdwh3ffrwuq

    and here:

    http://markmail.org/message/iik2xe7mk47baium

    Andrus

    On Sep 15, 2008, at 12:22 PM, Laurent Marchal wrote:

    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.


  • Laurent Marchal at Sep 15, 2008 at 2:20 pm
    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.
  • Andrus Adamchik at Sep 15, 2008 at 2:26 pm
    Hi there! This is the 3rd copy of the same message that got sent to
    the list. So I assume you are not getting our replies via the list?
    There were replies to both of your messages, please check the archives
    here: http://cayenne.markmail.org/search/

    Also note that your smaeur.com address is subscribed, so you should be
    getting replies at that address, while gmail.com address is NOT
    subscribed.

    Thanks,
    Andrus

    On Sep 15, 2008, at 5:11 PM, Laurent Marchal wrote:

    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.


  • Laurent Marchal at Sep 15, 2008 at 2:42 pm
    Hi Andrus,

    Sorry i think i have a problem with my internet provider which seems
    block emails coming from this list !
    I will use the archives until all is ok. Sorry all for the spam !

    Andrus Adamchik wrote:
    Hi there! This is the 3rd copy of the same message that got sent to
    the list. So I assume you are not getting our replies via the list?
    There were replies to both of your messages, please check the archives
    here: http://cayenne.markmail.org/search/

    Also note that your smaeur.com address is subscribed, so you should be
    getting replies at that address, while gmail.com address is NOT
    subscribed.

    Thanks,
    Andrus

    On Sep 15, 2008, at 5:11 PM, Laurent Marchal wrote:

    Hello !

    I use Cayenne 3.0M4 and since UpdateQuery is deprecated i use a
    SQLTemplate query to do an UPDATE.
    The thing is i would like to know how many rows are updated, and the
    query returns no DataRows.

    SQLTemplate query = new SQLTemplate(..., "UPDATE...");
    query.setFetchingDataRows(true);

    List<DataRow> dtList = context.performQuery(query);

    the returned list is always empty....
    How can i get the precious Integer saying "X rows updated" ?

    Thanks.
    Laurent Marchal.



Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedSep 11, '08 at 3:54p
activeSep 15, '08 at 2:42p
posts8
users4
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase