Re: Decline of Science: Computer Science and Databases

From: Carl Rosenberger <carl_at_db4o.com>
Date: Thu, 28 Nov 2002 17:12:45 +0100
Message-ID: <as5fmh$sn6$07$1_at_news.t-online.com>


Bob Badour wrote:
> > Following your approach, one would model all hierarchies into
> > relations. Could you please outline, how a query to print out
> > all contracts with all positions including all data special to
> > all derived classes would look like?
> >
> > Here is mine:
> >
> > ObjectSet set = db.get(new Contract());
> > while(set.hasNext()){
> > System.out.println(set.next().toString());
> > }
>
> So, basically you are saying that your approach will print one and only one
> report, and a programmer must encode all of the logic for formatting that
> report and for handling report breaks etc. in one or more toString methods.

No.

I am saying that it would be a pain to write one single SQL statement to assemble all Contracts with all Positions with Alfredo's approach. It would be full of outer joins.
It would need to be rewritten, every time a new Class is added to the repository.

Formatting the data is a completely different matter and I am sorry for being unprecise.

Let me rephrase my question please:

"How would you iterate through all contracts with SQL?"

Here is my solution:

ObjectSet set = db.get(new Contract());
while(set.hasNext()){
  set.next();
}

Kind regards,
Carl

--
Carl Rosenberger
db4o - database for objects - http://www.db4o.com
Received on Thu Nov 28 2002 - 17:12:45 CET

Original text of this message