[Seaside] How to use SERIAL?

Yoshiki.Ohshima at acm.org Yoshiki.Ohshima at acm.org
Wed Jun 4 14:09:03 CEST 2003


  Hello,

  Suppose I have this two column table created by this SQL statement:

       CREATE TABLE foo (id SERIAL PRIMARY KEY, name text);

and want to map a Squeak object (aFoo) with a row in this table.

  I looked at the implementors/senders of #isGenerated and such, but I
couldn't figure out how to write the correct mapping so that the
following code adds a new row with proper id value in to the table:

  session := GlorpSession ...

  session beginUnitOfWork.
  aFoo := Foo new.
  aFoo name: 'test'.
  session register: aFoo.  "'id' is nil"
  session endUnitOfWork.

  The 'id' of aFoo doesn't have to be filled out with the generated id
value at this point.

  Also, I can't find a method which is similar to #readManyOf:where:
but doesn't get #where: block.  I.e. I want to do a query which
doesn't have the WHERE clause:

  SELECT * FROM foo; 

and get the array of Foo objects.  Is there any way to use
#readManyOf:where: for this purpose, or any reason not to have such
method?

  I'd like to say that GLORP and Seaside (and Squeak, of course) made
this development work managable.  Thank you again for making it
available!

-- Yoshiki



More information about the Seaside mailing list