You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by David Morales de Frias <dm...@gpm.es> on 2004/11/04 10:37:15 UTC

Help with references

One question...

As i can see, my repository's configuration is ok.

I have this field

        <field-descriptor
                name="cod_tdestinoId"
                column="COD_TDESTINO"
                jdbc-type="VARCHAR"
                access="anonymous"
        />

and this reference-descriptor

        <reference-descriptor
                name="idDestino"
                class-ref="es.indra.aunabill.vo.Tdestinos"
        >
                <foreignkey field-ref="cod_tdestinoId"/>
        </reference-descriptor>

But in the table's bean in java, i think i must have a property (with its getter and setter) which name must be "idDestino"

Is that true??

Which kind of type must be this property?, String? int?

Thank a lot.





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Help with references

Posted by Armin Waibel <ar...@apache.org>.
Hi David,

David Morales de Frias wrote:

> One question...
> 
> As i can see, my repository's configuration is ok.
> 
> I have this field
> 
>         <field-descriptor
>                 name="cod_tdestinoId"
>                 column="COD_TDESTINO"
>                 jdbc-type="VARCHAR"
>                 access="anonymous"
>         />
> 
> and this reference-descriptor
> 
>         <reference-descriptor
>                 name="idDestino"
>                 class-ref="es.indra.aunabill.vo.Tdestinos"
>         >
>                 <foreignkey field-ref="cod_tdestinoId"/>
>         </reference-descriptor>
> 
> But in the table's bean in java, i think i must have a property (with its getter and setter)

You don't need to specify getter and setter (default behavior). It 
depends on the used PersistentField implementation.
http://db.apache.org/ojb/docu/guides/advanced-technique.html#Change+PersistentField+Class


> which name must be "idDestino"
> 
> Is that true??
>

yep!


> Which kind of type must be this property?, String? int?
>

Must be 'es.indra.aunabill.vo.Tdestinos' the type of the referenced 
class. You set the FK as anonymous field, so no need to specify 
'cod_tdestinoId' in your bean.


regards,
Armin

> Thank a lot.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org