You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by ol...@ppi.de on 2003/04/10 15:45:32 UTC

setting reference fields to null

Hello,

there is a behaviour that has been reported on this list
before (see "HELP!! Problem when updating foreign key reference to null.")

When you read an object with a non-null referenec field
from the database and set that reference field to null,
the object will not get be updated.  Even in case you change
some other field, so that the object IS written to the
database, the reference remains non-null in the database.

Is there some fix or workaround for this?  We have an
object model in which null references occur often and have
a designated meaning.

Olli

-- 
  Dr. Oliver Matz
  ppi Media GmbH
  Deliusstraße 10
  D-24114 Kiel
  phone	+49 (0) 43 1-53 53-422
  fax     	+49 (0) 43 1-53 53-2 22
  email	mailto:oliver.matz@ppi.de
  web	www.ppi.de


Re: setting reference fields to null

Posted by Oki DZ <ok...@pindad.com>.
On Thu, Apr 10, 2003 at 03:45:32PM +0200, oliver.matz@ppi.de wrote:
> Is there some fix or workaround for this?  We have an
> object model in which null references occur often and have
> a designated meaning.

I think you could have a PersistenceBroker listener and implement the
afterStore method, which has a QueryBySql to directly update the
intended table fields. Problem is, there would be (at least) two queries
to the db on every single object store.

Oki