[ http://jira.andromda.org/browse/EJB-57?page=comments#action_15480 ] 

Vance Karimi commented on EJB-57:
---------------------------------

Hi Leandro,

You're right, the reason why the datatype defaults to java.util.Set is because 
the 'specificCollectionInterfaces' namespace property is set to false in the 
namespace.xml of the cartridge.  Hence, the default datatype is defined in the 
'defaultCollectionInterface' namespace property, which as you guessed, is 
java.util.Set.

Then, getCollectionTypeImplementation calls getCollectionTypeImplemenationClass 
which checks if the many end is modeled as a set, map, list or collection (in 
that order).  The isSet, isMap, isList and isCollection methods all check if 
the ordering has been set.  If ordering is set, then the set and map types are 
not used.  So for list or collection ends, the ArrayList implementation is used.

I can't remember what impact it will have to set the 
specificCollectionInterfaces namespace property to true, but I do recall I had 
problems using List.  Look back through the forums and have a read of the 
changes.xml (Line 127).  I originally changed it from List to to SortedSet, 
then later changed it to TreeSet (Line 249), then finally changed it to Set 
(Line 254).

We could leave the defaultCollectionInterfaces as is (Set).  In 
getGetterSetterTypeName where we are invoking getDefaultCollectionInterface to 
get the default type, we should instead check if ordering has been defined and 
return an appropriate type, such as List.  This would require a bit of testing.

> UML {ordered} produces invalid code
> -----------------------------------
>
>          Key: EJB-57
>          URL: http://jira.andromda.org/browse/EJB-57
>      Project: EJB Cartridge
>         Type: Bug

>  Environment: AndroMDA 3.3-SNAPSHOT on Windows using EJB3-cartridge 
> (HEAD-checkout from 16th may 2007)
>     Reporter: Tun Schlechter
>     Assignee: Vance Karimi
>  Attachments: bugreport-ordered.zip
>
> A one to many association between 2 <<entity>> classes [Class_1 and Class_2] 
> with {ordered} tag on the many side produces the following code within 
> Class_1:
> private java.util.Set<Class_2> class_2s = new java.util.ArrayList<Class_2>();
> and thus the expected following error: 
> C:\work\bugreport-ordered\core\target\src\Class_1.java:[35,46] incompatible 
> types
> found   : java.util.ArrayList<Class_2>
> required: java.util.Set<Class_2>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Reply via email to