What I'm looking for specifically (and what I really enjoyed in Hibernate, which in my book sets the standard for ORMs if you hadn't already guessed) was something like the following:

ImagePlacements
---------------
article_id: Article
image_id: Image
source_name: String

This would allow me to have the following in my data model:

a= Article.get(1)
mainImage= a.imagePlacements["main"]
featureImage= a.imagePlacements["feature"]

This simply can't be done with SQLObject today.

On 2 Nov, 2005, at 1:51 pm, anders pearson wrote:

On 2005-11-02 09:27:11 -0800, [EMAIL PROTECTED] wrote:

I am confused again. How would you design this :

Invoice <--> Payment

where each invoice can have multiple payments and each payment can pay
multiple invoice. Isn't it natural to have a tuple (invoice, payment,
amount) which is a join and also have attribute that is essential ?

i'm not sure i understand your example. what would the underlying
database tables look like?

what i'm saying is that if you have a table like

  foobar
  ------------
  foo_id
  bar_id

then SQLObject handles that just fine with

  class Foo(SQLObject):
       bars = RelatedJoin('Bar')

  class Bar(SQLObject):
       foos = RelatedJoin('Foo')

but if you want the join table to look like:

  foobar
  ----------
  foo_id
  bar_id
  some_other_field

you should use something more like:

  class Foo(SQLObject):
      bars = MultipleJoin('FooBar')

  class Bar(SQLObject):
      foos = MultipleJoin('FooBar')

  class FooBar(SQLObject):
      foo = ForeignKey('Foo')
      bar = ForeignKey('Bar')
      some_other_field = StringCol()

--
anders pearson : http://www.columbia.edu/~anders/
   C C N M T L : http://www.ccnmtl.columbia.edu/
        weblog : http://thraxil.org/

--
Jeff Watkins
http://newburyportion.com/

"Just because you have the right to do something, doesn't mean it's the right thing to do."
-- Fred Friendly, former president of CBS News


Reply via email to