Re: Null pointer exceptions and database null

From: Mike Kienenberger (mkienen..mail.com)
Date: Thu Aug 03 2006 - 17:16:02 EDT

  • Next message: Marcel: "XMPP event notification"

    This is also the piece of code you can modify to fit your definition
    of "want Cayenne not to modify the database unecessarily" by skipping
    setting any equivalent values.

    On 8/3/06, Mike Kienenberger <mkienen..mail.com> wrote:
    > For JSF, it updates values even if the values haven't changed. So I
    > check for that condition and if so, I don't actually update anything.
    >
    > The safety issue is that DataObjects are only equal if it's the same
    > object in memory. So assigning another seemingly identical object
    > would sneak through.
    >
    > I eventually (last week) wrote a new equals() method for my
    > BaseDataObject class that makes DataObjects equal if their ObjectId
    > value is equal. I'm hoping that will do what I want, but I'm a bit
    > nervous about changing DataObject equality.
    >
    >
    > On 8/3/06, Øyvind Harboe <oyvind.harbo..ylin.com> wrote:
    > > Super!
    > >
    > > > // TODO: needed for JSF
    > > > Object oldValue = readProperty(propName);
    > > > if (oldValue == value)
    > > > {
    > > > // NOOP
    > > > return;
    > > > }
    > > > if (null != oldValue)
    > > > {
    > > > if (oldValue.equals(value))
    > > > {
    > > > // NOOP
    > > > // IMPLEMENT: not sure if this is safe!
    > >
    > > What does this comment mean?
    > >
    > >
    > >
    > > --
    > > Øyvind Harboe
    > > http://www.zylin.com
    > >
    >



    This archive was generated by hypermail 2.0.0 : Thu Aug 03 2006 - 17:16:27 EDT