persistence@glassfish.java.net

Re: Problems Mapping Map

From: fedr <fury123_at_gmail.com>
Date: Fri, 4 Apr 2008 02:20:18 -0700 (PDT)

Marina Vatkina wrote:
>
> How does the combination of class3_id and the hm_id define to association
> between Class1 and Class2?
>
> thanks,
> -marina
>
>

I am not sure to understand what information you asked me, but to show you
what i mean this is the database schema of class2_class3 that define the
association in the map

CREATE TABLE class3_class2
(
  class3_id integer NOT NULL,
  hm_id integer NOT NULL,
  CONSTRAINT class3_class2_pkey PRIMARY KEY (class3_id, hm_id),
  CONSTRAINT fk_class3_class2_class3_id FOREIGN KEY (class3_id)
      REFERENCES class3 (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk_class3_class2_hm_id FOREIGN KEY (hm_id)
      REFERENCES class2 (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);


if you see there is no reference to Class1.

But if i try to generate the schema with hibernate, same database, same
classes, i get this one :

CREATE TABLE class3_class2
(
  class3_id integer NOT NULL,
  hm_id integer NOT NULL,
  mapkey_id integer NOT NULL,
  CONSTRAINT class3_class2_pkey PRIMARY KEY (class3_id, mapkey_id),
  CONSTRAINT fk396040be7a38f2a7 FOREIGN KEY (class3_id)
      REFERENCES class3 (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk396040be80c8af1c FOREIGN KEY (hm_id)
      REFERENCES class2 (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk396040bed96997dd FOREIGN KEY (mapkey_id)
      REFERENCES class1 (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);

where, as you can see, there is the mapkey_id column that reference to
Class1 id and with this it works.

But i want to use toplink not hibernate, i don't know why it is different,
the code of the classes is the same, like the annotation that i used.

Thanks for the help
Bye

-- 
View this message in context: http://www.nabble.com/Problems-Mapping-Map-tp16468447p16489820.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.