db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Issue 145: Mapping Map with embedded PersistenceCapable
Date Mon, 21 Nov 2005 23:00:26 GMT
Just one more comment. The fact that a PersistenceCapable should use  
datastore identity is orthogonal to whether it contains a field that  
can uniquely identify the instance. It is considered best practice in  
some circles to use a surrogate key for identifying instances in the  
datastore regardless of whether there is a field that is unique. So I  
don't see the need for arbitrarily restricting the use case simply  
because there is no persistent identity for the key instances.

Craig

On Nov 21, 2005, at 2:43 PM, Craig L Russell wrote:

> Hi Abe,
>
> On Nov 21, 2005, at 12:59 PM, Abe White wrote:
>
>>> The issue came up with the TCK where we were trying to get JPOX  
>>> to recognize that an embedded PersistenceCapable in a join table  
>>> can have a unique identifying field. In the case of datastore  
>>> identity, this doesn't work because there is no primary key field  
>>> in the PersistenceCapable.
>>>
>>> <proposed 18.14>
>>> A portable mapping for arrays, collections, and maps will include  
>>> a primary key on the join table.
>>> </proposed 18.14>
>>
>> Why?  I don't understand this at all.  "Datastore identity" is  
>> meaningless in this context, as embedded objects have no identity  
>> according to the spec.
>
> Right. They have no persistent identity. Therefore, if you want to  
> use an embedded PersistenceCapable as a key, you need to identify  
> one of the embedded fields as a key for the purpose of the map. The  
> alternative is to simply disallow using an embedded  
> PersistenceCapable as a key in a map if  the class is defined as  
> datastore identity. But this seems pretty arbitrary.
>
> Craig
>
> Craig Russell
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message