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 Pulat Yunusov <pu...@3genius.com> on 2004/09/14 00:53:57 UTC

Anonymous keys

What is the purpose of anonymous keys? Given class A and class B where
class A has a reference to class B, I removed setId() from both classes,
and setBId() and getBId() from class A. I still have private members id
in both classes, and bId in class A as well as all corresponding field
and reference descritors in the mapping file.

I have not set access to any of the fields as "anonymous" in the mapping
file.

Following that, I have no problem creating instances and setting a
reference between them, persisting them or retrieving them.

I thought you needed anonymous keys for that kind of behavior but I
didn't use them. Can OJB access private instance variables to keep track
of relationships? What exactly are anonymous keys for?

Thank you,

Pulat



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


Re: Anonymous keys

Posted by Pulat Yunusov <pu...@3genius.com>.
Thank you, Brian. Your reply was very helpful.

Pulat

Brian McCallister wrote:

> Anonymous keys allow you to not have the FK field (or PK if you never 
> need serialize them) defined on the classes. By default OJB talks 
> directly to fields, not through property accessors (though it certainly 
> can work through property accessors).
> 
> -Brian
> 
> On Sep 13, 2004, at 6:53 PM, Pulat Yunusov wrote:
> 
>> What is the purpose of anonymous keys? Given class A and class B where
>> class A has a reference to class B, I removed setId() from both classes,
>> and setBId() and getBId() from class A. I still have private members id
>> in both classes, and bId in class A as well as all corresponding field
>> and reference descritors in the mapping file.
>>
>> I have not set access to any of the fields as "anonymous" in the mapping
>> file.
>>
>> Following that, I have no problem creating instances and setting a
>> reference between them, persisting them or retrieving them.
>>
>> I thought you needed anonymous keys for that kind of behavior but I
>> didn't use them. Can OJB access private instance variables to keep track
>> of relationships? What exactly are anonymous keys for?
>>
>> Thank you,
>>
>> Pulat
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: Anonymous keys

Posted by Brian McCallister <mc...@forthillcompany.com>.
Anonymous keys allow you to not have the FK field (or PK if you never 
need serialize them) defined on the classes. By default OJB talks 
directly to fields, not through property accessors (though it certainly 
can work through property accessors).

-Brian

On Sep 13, 2004, at 6:53 PM, Pulat Yunusov wrote:

> What is the purpose of anonymous keys? Given class A and class B where
> class A has a reference to class B, I removed setId() from both 
> classes,
> and setBId() and getBId() from class A. I still have private members id
> in both classes, and bId in class A as well as all corresponding field
> and reference descritors in the mapping file.
>
> I have not set access to any of the fields as "anonymous" in the 
> mapping
> file.
>
> Following that, I have no problem creating instances and setting a
> reference between them, persisting them or retrieving them.
>
> I thought you needed anonymous keys for that kind of behavior but I
> didn't use them. Can OJB access private instance variables to keep 
> track
> of relationships? What exactly are anonymous keys for?
>
> Thank you,
>
> Pulat
>
>
>
> ---------------------------------------------------------------------
> 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