Doh... I see where I have a primary key afterall... That was STUPID on my
part.

-----Original Message-----
From: John Menke [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 06, 2002 12:56 PM
To: struts-user
Subject: simper and linking tables (many to many relationships)


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]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to