Tim, OJB after .9.7 started to set the FK to null if the actual reference object is null at the time of storage. This behavior broke my programs and I had to comment out that line from the assertFK...() function inside PersistaeceBrokerSingleVM.
I suggested making this an optional trait, to be set in the repository on the reference object, but haven't heard anything from the developers. Caster ----- Original Message ----- From: "Tim Drury" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 04, 2003 5:32 PM Subject: Re: update setting FK to null > > I forgot to mention I'm running 0.9.9. Here is a little more info. From > my log: > > [17:08:04,955,OJBORMManager] DEBUG save: class=common.model.Note > [17:08:04,955,OJBORMManager] DEBUG save: > o=[Note:id=59,code=NOTE79,subcode=foo,ident=ID2564,desc=this is a debug > note,ownerId=74,docId=16] > [17:08:04,965,JdbcAccessImpl] ERROR SQLException during the execution of > the update (for a common.model.Note): ERROR: ExecUpdate: Fail to add null > value in not null attribute documentid > > Note is the object that ties an Invoice and a Person object together in an > M:N relationship. It's PK is id=59. It has two foreign keys, ownerId=74 > points to the Person and docId=16 points to the Invoice. Upon saving, it > tries to put null into the DOCUMENTID database column. Here is my p6spy > log: > > 1046815684955|0|0|statement|SELECT > LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT ION,ID > FROM shipnote WHERE ID = ? |SELECT > LASTMODIFIED,DOCUMENTID,TIMECREATED,IDENTIFIER,SUBCODE,OWNERID,CODE,DESCRIPT ION,ID > FROM shipnote WHERE ID = '59' > > 1046815684965|0|0|statement|UPDATE shipnote SET TIMECREATED=?, > LASTMODIFIED=?, CODE=?, SUBCODE=?, IDENTIFIER=?, DESCRIPTION=?, OWNERID=?, > DOCUMENTID=? WHERE ID = ? |UPDATE shipnote SET TIMECREATED='2003-03-04 > 17:08:04.154', LASTMODIFIED='2003-03-04 17:08:04.154', CODE='NOTE79', > SUBCODE='foo', IDENTIFIER='ID2564', DESCRIPTION='this is a debug note', > OWNERID='', DOCUMENTID='' WHERE ID = '59' > > I also tried making a trivial change to the Invoice object and save the > invoice, but got the same docId=null error for the note even though I had > not made any changes to the note object. > > Any ideas (any!) would be appreciated, > > -tim > > > > > > When I update the link object (the object between to others in an M:N > > relationship), the FKs to the outer objects are being set to null in > > outgoing SQL according to p6spy. Am I forgetting to do something? The > > code is the typical, > > > > broker.beginTransaction(); > > broker.store(o); > > broker.commitTransaction(); > > > > everything works fine when creating the objects the first time, only > > updates show this problem. > > > > I thought there was something on the list earlier about this but, alas, > > the archives (both jakarta and db) don't seem be getting updated since > > mid February. > > > > Thanks, > > > > -tim > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
