polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: ManyAssociation a List or a Set?
Date Thu, 15 Jun 2017 08:18:21 GMT
ManyAssociation.toList() says this;

* <p>
* Multiple references to the same entity will be present multiple
times in the List, unlike {@link #toSet()}.
* The order in which the entities were added to this collection is preserved.
* </p>

This clearly says that (at some point) multiple instances of the same
reference was intended to be possible. Although that has not been the case
for quite a while (before 2009).



On Thu, Jun 15, 2017 at 3:54 PM, Niclas Hedhman <niclas@hedhman.org> wrote:

> Gang,
>
> I found a quite serious bug in DefaultNamedAssociation, but since
> MapEntityStore didn't user the "UPDATED" information about an entity, it
> didn't manifest itself other than in the Preference and Cassandra ES
> implementations, not using the MapES.
>
> So, I went to check if the same fault was in the ManyAssociation and to my
> surprise, I saw the following code;
>
> if( references.contains( entityReference ) )
> {
>     return false;
> }
>
> references.add( i, entityReference );
> entityState.markUpdated();
> return true;
>
>
> which means that it is a SET and not a LIST/SEQUENCE. But we have method
> toList() and toSet() on ManyAssociation, as I think we originally intended
> the internals to be a LIST.
>
> Does anyone have any insight and opinion on this topic?
>
>
> Cheers
> --
> Niclas Hedhman, Software Developer
> http://polygene.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

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