I want to have something like with in the SQL:

SELECT ...FROM ... WHERE
"Emprunt"."IdEmprunt"*="TraceLog"."IdGenerique"  AND ...

But not :

SELECT ...FROM ... WHERE
"Emprunt"."IdGenerique"*="TraceLog"."IdGenerique"  AND ...




----- Original Message -----
From: "Micka�l Guessant" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 6:08 PM
Subject: Re: [castor-dev] primary and foreign keys with the different names


>
> Just change the many-key value in mapping :
>
>    <!-- relation: TraceLog -->
>    <field name="TraceLog" type="facastor22.TraceLog"
collection="arraylist"
> get-method="getTraceLogAsReference" set-method="setTraceLogAsReference">
>     <sql many-key="IdGenerique"/>
>    </field>
>
>
> gidro99 wrote:
> > How I have to write a mapping file if the primary and foreign keys have
> > different names in the databse ?
> >
> > How U can see I have 2 tables:
> > - Emprunt (IdEmprunt PK)
> > - TraceLog (FK)
> >
> > Mapping file:
> > -------------------------------------------
> > <mapping>
> >
> >  <class name="facastor22.Emprunt" identity="IdEmprunt"
key-generator="MAX">
> >   <map-to table="Emprunt" xml="Emprunt"/>
> >   <!-- PK: begin -->
> >   <field name="IdEmprunt" type="java.lang.Integer"
get-method="getIdEmprunt"
> > set-method="setIdEmprunt">
> >    <sql name="IdEmprunt" type="integer"/>
> >   </field>
> >
> >   <!-- relation: TraceLog -->
> >   <field name="TraceLog" type="facastor22.TraceLog"
collection="arraylist"
> > get-method="getTraceLogAsReference" set-method="setTraceLogAsReference">
> >    <sql many-key="IdEmprunt"/>
> >   </field>
> >     ....
> > </class>
> >
> >  <class name="facastor22.TraceLog" identity="IdTypeTraceLog DtTraceLog"
> > depends="facastor22.Emprunt">
> >   <map-to table="TraceLog" xml="TraceLog"/>
> >
> >   <!-- relation: Emprunt -->
> >   <field name="Emprunt" type="facastor22.Emprunt" required="true">
> >    <sql name="IdGenerique"/>
> >   </field>
> >     ....
> > </class>
> >
> > </mapping>
> > -------------------------------------------------
> >
> > There is an exception:
> > java.sql.SQLException: Invalid column name 'IdEmprunt'
> >
> > in request:
> > -----------------
> > SELECT
> >
"Emprunt"."IdEmprunt","TraceLog"."IdTypeTraceLog","TraceLog"."DtTraceLog","A
> >
mortissement"."IdAmortissement","EcheanceAmortissement"."IdEcheanceAmortisse
> >
ment","Interet"."IdInteret","IndexTaux"."IdIndexTaux","EcheanceInteret"."IdE
> >
cheanceInteret","EcheanceFlux"."IdEcheanceFlux","Emprunt"."IdClient","Emprun
> >
t"."IdAgence","Emprunt"."IdContact","Emprunt"."IdTypeEmprunt","Emprunt"."IdE
> >
mpruntPere","Emprunt"."IdEtatEmprunt","Emprunt"."IdNature","Emprunt"."IdBanq
> >
ue","Emprunt"."CdRefFinact","Emprunt"."CdRefClient","Emprunt"."FlMontantInit
> >
ial","Emprunt"."FlPrix","Emprunt"."DtRealisation","Emprunt"."DtFinDette","Em
> >
prunt"."DtFinMobilisation","Emprunt"."DtChgntPhase","Emprunt"."InDureeDette"
> >
,"Emprunt"."RtMarche","Emprunt"."LbLibelle","Emprunt"."LbCommentaire","Empru
> > nt"."IdDeviseCalendrier" FROM
> >
"Amortissement","TraceLog","EcheanceFlux","EcheanceInteret","EcheanceAmortis
> > sement","IndexTaux","Interet","Emprunt" WHERE
> > "Emprunt"."IdEmprunt"*="TraceLog"."IdEmprunt"  <-- not 'IdGenerique' :o(
> >  AND  "Emprunt"."IdEmprunt"*="Amortissement"."IdEmprunt"
> >  AND  "Emprunt"."IdEmprunt"*="EcheanceAmortissement"."IdEmprunt"
> >  AND  "Emprunt"."IdEmprunt"*="Interet"."IdEmprunt"
> >  AND  "Emprunt"."IdEmprunt"*="IndexTaux"."IdEmprunt"
> >  AND  "Emprunt"."IdEmprunt"*="EcheanceInteret"."IdEmprunt"
> >  AND  "Emprunt"."IdEmprunt"*="EcheanceFlux"."IdEmprunt"
> >  AND  ("Emprunt"."IdEmprunt" = ?)
> > -------------
> >
> > Or in this case I have to define the class TraceLog like independent and
to
> > load TraceLog objects for corresponding Emprent myself ???
> >
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> > unsubscribe castor-dev
> >
> >
> >
>
>
> --
> Mickael Guessant
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to