Thank you Patrick and Bruce. Fortunately, the database team has agreed to add a single PK field and place a unique constraint on the combination of the 2 FK fields that previously made up the PK.
Thanks again for your feedback. --- Patrick van Kann <[EMAIL PROTECTED]> wrote: > Hello Konrad, > > Unfortunately Castor does not support this kind of > relationship fully. > > The problem (and a partial work-around) is described > here: > > http://bugzilla.exolab.org/show_bug.cgi?id=925 > > I hope this is of some help. > > Cheers, > > Patrick > > > -----Original Message----- > From: Konrad [mailto:[EMAIL PROTECTED] > Sent: Tue 6/1/2004 6:18 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: [castor-dev] Re: [JDO] URGENT: Can Castor > handle a PK composed of 2 FKs? (could not set value > of FieldMolder) > > > Here is more detail on the problem that I've > having... > > > Stack Trace > =========== > > Type conversion error: could not set value of > FieldMolder of > entity.ProvinceLang.setprovince(entity.Province > province) with value of type java.lang.Integer > org.exolab.castor.jdo.DataObjectAccessException: > Type > conversion error: could not set value of FieldMolder > of entity.ProvinceLang.setprovince(entity.Province > province) with value of type java.lang.Integer > at > org.exolab.castor.persist.FieldMolder.setValue(FieldMolder.java:330) > at > org.exolab.castor.persist.ClassMolder.setIdentity(ClassMolder.java:2738) > at > org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:707) > at > org.exolab.castor.persist.LockEngine.load(LockEngine.java:359) > at > org.exolab.castor.persist.TransactionContext.load(TransactionContext.java:649) > ... > > > Mapping > ======= > > <mapping> > > <!-- Language --> > <class name="entity.Language" identity="code"> > <map-to table="lang"/> > <field name="code" type="string"> > <sql name="lang_id" type="char"/> > </field> > <field name="name" type="string"> > <sql name="lang_nam" type="char"/> > </field> > </class> > > <!-- Province --> > <class name="entity.Province" identity="id"> > <map-to table="prvnc"/> > <field name="id" type="integer"> > <sql name="prvnc_id" type="integer"/> > </field> > <field name="referenceName" type="string"> > <sql name="prvnc_nam" type="char"/> > </field> > </class> > > > <!-- ProvinceLang --> > <class name="entity.ProvinceLang" > identity="province language"> > <map-to table="prvnc_lang"/> > <field name="province" > > type="entity.Province"> > <sql name="prvnc_id"/> > </field> > <field name="language" > type="entity.Language"> > <sql name="lang_id"/> > </field> > <field name="name" type="string"> > <sql name="prvnc_lang_nam" > type="char"/> > </field> > </class> > > </mapping> > > > > Database tables (using PostgreSQL) > =============== > > --LANG > CREATE TABLE public.LANG > ( > LANG_ID char(2) NOT NULL, > LANG_NAM varchar(50) NOT NULL, > CONSTRAINT LANG_pkey PRIMARY KEY (LANG_ID) > ) WITHOUT OIDS; > > > --PRVNC > CREATE TABLE public.PRVNC > ( > PRVNC_ID int4 NOT NULL, > PRVNC_NAM varchar(50) NOT NULL, > CONSTRAINT PRVNC_pkey PRIMARY KEY (PRVNC_ID) > ) WITHOUT OIDS; > > > --PRVNC_LANG > CREATE TABLE public.PRVNC_LANG > ( > PRVNC_ID int4 NOT NULL, > LANG_ID char(2) NOT NULL, > PRVNC_LANG_NAM varchar(50) NOT NULL, > CONSTRAINT PRVNC_LANG_pkey PRIMARY KEY (PRVNC_ID, > LANG_ID), > CONSTRAINT LANG_FK FOREIGN KEY (LANG_ID) > REFERENCES > public.LANG (LANG_ID) ON UPDATE RESTRICT ON DELETE > RESTRICT, > CONSTRAINT PRVNC_FK FOREIGN KEY (PRVNC_ID) > REFERENCES public.PRVNC (PRVNC_ID) ON UPDATE > RESTRICT > ON DELETE RESTRICT > ) WITHOUT OIDS; > > > > > > > --- Konrad <[EMAIL PROTECTED]> wrote: > > > > I'm running into a slight roadblock with our > > database > > model and Castor, as I'm getting an error when > > trying > > to retrieve an object that maps to a table, whose > > Primary Key is made up of two fields, both of > which > > are Foreign Keys referencing other tables. > > > > Can Castor handle this scenario whereby a Primary > > Key > > is composed of two Foreign Keys? > > > > Please let me know ASAP as I need to make a > decision > > on what to do if Castor cannot handle this > > situation. > > > > Thank you very much!!! > > > > > __________________________________ > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger. > http://messenger.yahoo.com/ > > > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send > mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > > > > > ATTACHMENT part 2 application/ms-tnef name=winmail.dat > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send > mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-user
