> -----Original Message-----
> From: devl-bounces at freenetproject.org 
> > @@ -178,8 +178,20 @@
> >     public synchronized Iterator<FMSMessage> threadIterator(final
> FMSOwnIdentity identity) {
> >             return new Iterator<FMSMessage>() {
> >                     private final FMSOwnIdentity mIdentity 
> = identity;
> > -                   private Iterator<FMSMessage> iter = 
> self.mThreads.iterator();
> > -                   private FMSMessage next = 
> iter.hasNext() ? iter.next() : null;
> > +                   private final ObjectSet<FMSMessage> mMessages;
> > +                   private final Iterator<FMSMessage> iter;
> > +                   private FMSMessage next;
> > +                    
> > +                   {
> > +                           Query q = db.query();
> > +                           q.constrain(FMSMessage.class);
> > +                           
> > q.descend("mBoards").constrain(mName); /* FIXME: mBoards is an array. 
> > Does constrain() check whether it contains the element mName? */
> 
> No.

This is bad news! It means that we will have to store a per board message
list in some way. Any ideas on how to do it efficiently using db4o as much 
as possible?

Well actually its good news: Even if that query was possible, it
would not be efficient anyway. The only efficient way of retrieving
messages per-board is to store a per-board list of messages of course.
As you know I had done that with LinkedLists and Hashtables in the past
but changed it to this simple db4o query for the sake of using db4o.

> > +                           q.descend("mParentURI").constrain(null);
> 
> You should add .identity(). However, in my experience 
> constraining to null doesn't work, or works but pulls in 
> every object rather than using the index.

This sucks. In my current design of the FMSMessage class, a thread is 
defined by not having a parent URI. It means that I will have to
add booleans everywhere where I use null as a special information.

Is this a db4o bug?

> 
> > +                           q.orderDescending();
> 
> Descending on which field?
> 

I had already fixed that. We sort by date.


Reply via email to