> -----Original Message----- > From: Matthew Toseland [mailto:toad at amphibian.dyndns.org] > Sent: Tuesday, December 16, 2008 12:03 AM > To: xor > Subject: Re: I need help with Db4o / Freetalk > > On Monday 15 December 2008 21:21, you wrote: > > > > > -----Original Message----- > > > From: Matthew Toseland [mailto:toad at amphibian.dyndns.org] > > > Sent: Monday, December 15, 2008 7:30 PM > > > To: xor > > > Subject: Re: I need help with Db4o / Freetalk > > > > > > On Monday 15 December 2008 13:45, you wrote: > > > > > > > > Hi, > > > > > > > > there is a severe Db4o problem in Freetalk: > > > > Instances of class Message can only be created with a > > > non-null member > > > > variable mAuthor. Further, mAuthor is final. So when receiving > > > > messages, the mAuthor field is definitely non-null when the > > > > Message objects are stored in the database. > > > > > > > > HOWEVER, when retrieving the Message objects from the > > > database, their > > > > mAuthor field is null! > > > > This also only happens on my normal node, if I run a > node in the > > > > debugger, it does not happen. > > > > > > > > The worst thing is: The problem is NOT that the Message objects > > > > are not fully activated. > > > > The plugin does a query at startup to find messages > with mAuthor > > > > == null by > > > > doing: > > > > > > > > Query q = db.query(); > > > > q.constrain(Message.class); > > > > q.descend("mAuthor").constrain(null).identity(); > > > > ObjectSet<Message> brokenMessages = q.execute(); > for(Message m : > > > > brokenMessages) { > > > > Logger.error(m, "Deleting message with mAuthor > == null: " + > > > > m.getURI()); > > > > db.delete(m); > > > > } > > > > > > Do you double check that it is in fact null? > > > > constrain(null).identity() should do a DEFINITE check whether it is > > null, shouldn't it? > > Maybe. In my experience, constain(null) doesn't use the > indexes, and generally conditions that don't use the indexes > don't get evaluated ... I'd double check.
Mmh okay. How to properly query for a member variable being null then?
