openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <mprud...@apache.org>
Subject Re: Are relation sets identity, pk or bean.equals() based?
Date Thu, 14 Dec 2006 00:56:47 GMT

> If you declare the field to be an interface type and you don't
> initialize the field to anything, I don't remember how we decide what
> impl to use.

Looking at the code in ProxyManagerImpl.java, it appears that we  
default to ArrayList for fields declared as type Collection, HashSet  
for fields declared as type Set, TreeSet for fields declared as type  
SortedSet, and ArrayList for fields declared as type List.




On Dec 13, 2006, at 4:47 PM, Patrick Linskey wrote:

>> -----Original Message-----
>> From: Dain Sundstrom [mailto:dain@iq80.com]
>> Sent: Wednesday, December 13, 2006 2:56 PM
>> To: open-jpa-dev@incubator.apache.org
>> Subject: Re: Are relation sets identity, pk or bean.equals() based?
>>
>> What I'm really asking is when OpenJPA loads a one-to-many field,
>> what kind of collection is injected into the bean?  Is it a
>> plain old
>> HashSet?  If not, what does the collection use to determine equality
>> between elements?
>
> It's a dynamically-generated subtype of whatever type that you specify
> in the field declaration. So, you need to have a no-args  
> constructor and
> the class can't be final.
>
> If you declare the field to be an interface type and you don't
> initialize the field to anything, I don't remember how we decide what
> impl to use.
>
> -Patrick
> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
> affiliated
> entities,  that may be confidential,  proprietary,  copyrighted   
> and/or
> legally privileged, and is intended solely for the use of the  
> individual
> or entity named in this message. If you are not the intended  
> recipient,
> and have received this message in error, please immediately return  
> this
> by email and then delete it.


Mime
View raw message