Re: dynamically adding derived EOAttribute

Christian Pekeler <[email protected]>
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
> I solved this. In order for the definition to 'stick', you need to 
> create the EOAttribute with the constructor that takes an EOEntity. It 
> has to already know it's entity to take a definition.
> This works:
>
>             EOAttribute countAtt = new EOAttribute(new 
> NSMutableDictionary(), entity);
>             countAtt.setName("_derivedCount");
>             countAtt.setColumnName("");
>             countAtt.setDefinition("count(*)");
>             countAtt.setExternalType("int");
>             countAtt.setValueClassName("NSNumber");
>             countAtt.setValueType("i");
>
> Questions:
>
> 1) Is this a bug? Either in documentation or in effect? Should I file 
> it?

I think EOAttribute is trying to parse the definition you pass it, and 
it needs to have a context (the owning EOEntity) to do this. So I would 
say the bug is that setDefinition() isn't raising an exception telling 
us about the missing EOEntity instead of silently ignoring the argument.

Christian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.