The reason for excluding collection references is that collections are
managed by Hibernate and you are not allowed to replace the collection
instance. For the same reason there is no 'set' method for collection
references. Use 'add' method to modify the collection content.

/Patrik


polly.c.chang wrote:
> 
> Hi,
> 
> I have a question about the "required" keyword.  The Advanced Tutorial
> says:
> 
> "As a complement to changeable you can use required for Attributes and
> References that are to be included in the constructor, but still have a
> setter method."
> 
> I find that when we set a Reference collection to required, it does not
> appear in the constructor.  The collection reference is like:
> 
> - List<@Foo> foos required
> 
> It turns out that the code in helper.ext specifically excludes Reference
> collections (see the last line):
> 
> List[NamedElement] getConstructorParameters(DomainObject domainObject) :
>     domainObject.getSuperConstructorParameters().
>         addAll(domainObject.attributes.select(a | (!a.changeable ||
> a.required))).
>         select(a | a != domainObject.getIdAttribute()).
>         addAll(domainObject.references.select(r | !r.many &&
> (!r.changeable || r.required)));
> 
> But Attribute collections that are "required" are included in the
> constructor.  Since Reference collections are specifically being excluded,
> there must be a very good reason, but I cannot figure out what that is. 
> Or is this a bug??
> 
> Thanks,
> Polly
> 

-- 
View this message in context: 
http://www.nabble.com/-Sculptor--%22required%22-and-collection-references-tp24432505s17564p24539754.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to