m-m is not yet supported in an elegent way by Simper. In the docs I
mention 1-1 and 1-m but I don't mention m-m for this reason.

As a tempoary workaround to get going, create another field in your
portfolio_stock table, called "id", and use it as a (pseudo) primary-key
(assigning it unique values, etc, upon every insert). I know that m-m
tables shouldn't require a primary key field (other than a composite of
the foreign keys), but that's just what Simper requires at this point.

Also -- perhaps you might join the simper-users mailing list at SF? I'm
not sure we want to bog down the Struts users lists with Simper usage
discussions.

Thanks!

Bryan


On Wed, 2002-03-06 at 10:56, John Menke wrote:

    I have the following model:
    
    -- Table: stock
    CREATE TABLE "stock" (
      "stock_pkey" int4 NOT NULL,
      "symbol" varchar(5) NOT NULL,
      "name" varchar(50) NOT NULL,
      "price" numeric(5, 3),
      CONSTRAINT "stock_symbol_key" UNIQUE ("symbol"),
      CONSTRAINT "stock_pkey" PRIMARY KEY ("stock_pkey")
    );
    
    
    -- Table: portfolio
    CREATE TABLE "portfolio" (
      "portfolio_pkey" int4 NOT NULL,
      "name" varchar(50),
      "investor_pkey" int4,
      CONSTRAINT "portfolio_pkey" PRIMARY KEY ("portfolio_pkey"),
      CONSTRAINT "<unnamed>" FOREIGN KEY ("investor_pkey") REFERENCES "investor"
    ("investor_pkey") ON DELETE NO ACTION ON UPDATE NO ACTION NOT DEFERRABLE
    INITIALLY IMMEDIATE
    );
    
    -- Table: portfolio_stock
    CREATE TABLE "portfolio_stock" (
      "stock_pkey" int4 NOT NULL,
      "portfolio_pkey" int4 NOT NULL,
      CONSTRAINT "portfolio_stock_pkey" PRIMARY KEY ("stock_pkey",
    "portfolio_pkey"),
      CONSTRAINT "<unnamed>" FOREIGN KEY ("portfolio_pkey") REFERENCES
    "portfolio" ("portfolio_pkey") ON DELETE NO ACTION ON UPDATE NO ACTION NOT
    DEFERRABLE INITIALLY IMMEDIATE,
      CONSTRAINT "<unnamed>" FOREIGN KEY ("stock_pkey") REFERENCES "stock"
    ("stock_pkey") ON DELETE NO ACTION ON UPDATE NO ACTION NOT DEFERRABLE
    INITIALLY IMMEDIATE
    );
    
    The portfolio_stock table is a linking table and does not have a primary
    key.  Is it possible to use this type of table in Simper?
    
    registerTable requires a primary key and my linking table does not contain a
    primary key.  I guess my question is can you do many to many relationships?
    If not is there a workaround?
    
    -john
    
    
    
    
    --
    To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
    
    

Reply via email to