As a side issue on documentation. I read this article on how to use
anonymous keys and I was left totally at a loss on what the associated code
should loook like. Maybe a little example would be useful.





|---------+---------------------------->
|         |           "Armin Waibel"   |
|         |           <[EMAIL PROTECTED]|
|         |           g>               |
|         |                            |
|         |                            |
|         |           02-Apr-2004 11:29|
|         |           Please respond to|
|         |           "OJB Users List" |
|         |           <[EMAIL PROTECTED]|
|         |           he.org>          |
|         |                            |
|---------+---------------------------->
  
>-------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |                                                                                    
                                     |
  |       To:      "OJB Users List" <[EMAIL PROTECTED]>                                
                                |
  |                                                                                    
                                     |
  |       cc:                                                                          
                                     |
  |       Subject: Re: relations and (additional) foreign keys in classes              
                                     |
  
>-------------------------------------------------------------------------------------------------------------------------|



Hi Matthias,

for 1:1 relation OJB has a feature called 'anonymous key'
http://db.apache.org/ojb/howto-use-anonymous-keys.html

<field-descriptor
         name="refFK"
         column="REF_FK"
         jdbc-type="INTEGER"
         access="anonymous" />

Thus you don't need to declare the FK in your class, only in metadata
and DB.

For single JVM 2-tier (no serialized persistent capable objects)
projects it is possible use this concept for other fields too (not only
1:1 references) - again, only in this case (OJB use in a object identity
based map for these anonymous fields).

regards,
Armin

Matthias Gottschlich wrote:
> Hi there,
>
> we are coming from j2ee-cmp and want to change to another o/r-mapping
> tool (perhaps ojb).
> In the Documentation i read, that i have to declare the foreign key as
> an extra member of my class, if i want to use a reference to the other
> class.
> Is this necessary? I came from EJB-CMP/CMR. There is no need to declare
> the foreign keys as class members. This is declared in the deployments
> descriptors and the mapping-definitions in the application servers. IS
> there a workaround to avoid the definition of foreign key class members?
>
> regards
> Matthias
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

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









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

Reply via email to