db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@jpox.org
Subject Re: User demand and Issue 150. [was Re: Issue 150: Consistency requirements for relationships with mapped-by]
Date Thu, 29 Dec 2005 23:41:50 GMT
Quoting Craig L Russell <Craig.Russell@Sun.COM>:

> > public class Invoice {
> >   private Set<Line> lines;
> >   public void addLine(Line line) {
> >       this.lines.add(line);
> >   }
> > }
> >
> > public class Line {
> >   private Invoice invoice;
> >   public void setInvoice(Invoice invoice) {
> >     this.invoice = invoice;
> >   }
> > }
> >
> > and I do this:
> >
> > static {
> >  Invoice invoice = Util.getPersistentInvoice("1234");
> >  Line line = new Line();
> >
> >  line.setInvoice(invoice):
> >  invoice.addLine(line);   /*expensive?*/
> > }
> >
> > that the JDO impl necessarily fetches the entire contents of the
> > Invoice.lines collection?  And *because* of this problem, you as a
> > user wish to avoid the invoice.addLine(line) call?
> >
> > I guess there might be JDO impl's out there which do that.  But I'd
> > rather pay money for a good one [1] which allowed me to control the
> > fetch policy.  There's absolutely no reason why the JDO impl needs
> > to go to the database to let me invoke .add() on a SCO collection,
> > until it needs to flush and do an INSERT.\

Remember the history about List.contains? Add, contains and many other
operations requires "(o==null ? e==null : o.equals(e))", in that sense you have
to load all objects.

JPOX, FYI, does not follow this rule and runs equality by comparing the identity
columns of these objects (primary keys for FCO) or the values for embedded
fields.

> >
>
> Craig Russell
>




Mime
View raw message