Re: SelectQuery and new objects

From: Mike Kienenberger (mkienen..mail.com)
Date: Mon May 19 2008 - 16:26:48 EDT

  • Next message: Mike Kienenberger: "Re: SelectQuery and new objects"

    You can use Expression.filterObject() to apply an expression to a set
    of in-memory objects, such as the results of newObjects().

    I had forgotten about that functionality until you mentioned "filtered
    by hand", but that's going to be close to SelectQuery behavior.

    On 5/19/08, Dirk Lattermann <dlat..lqualonde.de> wrote:
    > Am Montag, den 19.05.2008, 15:34 -0400 schrieb Mike Kienenberger:
    >
    > > It's true for all queries, but you can always ask the ObjectContext or
    > > DataContext for the list of new objects:
    > >
    > > public interface ObjectContext extends Serializable {
    > >
    > > /**
    > > * Returns a collection of objects that are registered with this
    > > ObjectContext and
    > > * have a state PersistenceState.NEW
    > > */
    > > Collection<?> newObjects();
    >
    >
    > Ok, thanks.
    > This always returns all new objects, though. So it seems they must be
    > filtered by hand to get something like the result of a qualified query.
    >
    > Thank you anyway,
    >
    > Dirk
    >
    >
    > > On 5/19/08, Dirk Lattermann <dlat..lqualonde.de> wrote:
    > > > Am Montag, den 19.05.2008, 14:20 -0500 schrieb Robert Zeigler:
    > > >
    > > > > The select query is going to run against data in the database, and
    > > > > will therefore /not/ return newly created but as yet uncommitted
    > > > > objects.
    > > > >
    > > >
    > > >
    > > > Aha, thank you! Is this true for all Query classes in Cayenne? In other
    > > > words, is there a Query (or some other means) to fetch uncommitted
    > > > objects?
    > > >
    > > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon May 19 2008 - 16:27:28 EDT