Hi Aaron,

1) You are right, I am using Eclipse and WOlips, so, forgive me for the old
times lingo, but I am really using Eclipse's (WOlips) Entity Modeler.

2) Since I am dedicating some time to deepen my understanding of Wonder I
decided to do it with a new Eclipse (Kepler) install. I am using Kepler and
the latest WOlips 4.3 stable build. After finishing installation I just
forgot to turn off generate bundles...

3) Unfortunately we need to live with the Eclipse problems. But Apple's PB
and EOModeler weren't free of problems too...

Angelo


2014-03-23 14:32 GMT-03:00 Aaron Rosenzweig <aa...@chatnbike.com>:

> Hi Angelo,
>
> Glad you got it working in the end. A couple things though:
>
> 1) You keep saying "EOModeler." Technically that is an Apple product that
> requires the Objective-C to Java bridge which has not worked since probably
> Mac OS X Tiger. Is that what you are using or are you using "EntityModeler"
> that runs in Eclipse?
>
> 2) Are you using the "bundle-less build" in Eclipse? If you are not, some
> of these problems could be related to that. Since it has been possible to
> run without generating a bundle, I doubt anyone has tested the older way
> much.
>
> 3) Eclipse just sucks... in general. I mean, it's a tall order, taking all
> those "dead" files on disk and then puffing them up like the "living dead"
> in a cool IDE so that you can see "who calls who" and "refactor" etc. But
> It's easy to get out of sync or just to have problems. If you are running
> EntityModeler on its own (Can you do that? I know RuleModeler can... I'm not
> sure about EntityModeler) then you better "refresh" all your projects and
> "clean" all your projects after you make an edit and save from
> EntityModeler. It's what I have to do when using any external tool. And
> sometimes, even when I'm totally in the Eclipse universe something
> invariably will screw the pooch and I need to "refresh" "clean all" and
> sometimes restart Eclipse. I call it the "Eclipse dance."
>   *Aaron Rosenzweig* / Chat 'n Bike <http://www.chatnbike.com>
> *e:*  aa...@chatnbike.com  *t:*  (301) 956-2319   [image: Chat 'n Bike]  
> [image:
> Chat 'n Bike]
>
> On Mar 23, 2014, at 11:58 AM, Ângelo Andrade Cirino <aacir...@gmail.com>
> wrote:
>
> Hi Aaron,
>
> Thank you for your prompt answer. Unfortunately none of the suggestions
> worked.
>
> 1) I can't find any combination of double or single apostrophe that will
> work. A similar MySQL SELECT statement is as simple as this
>
> select Party.id as partyID, (case status
> when 0 then 'Active'
>  when 1 then 'Inactive'
>     end) as fullStatus from Party;
>
> Even this simple derived attribute that returns a constant won't work
> (from the plist entity file):
>
> {
> columnName = fullStatus;
>  definition = "'Full Status'";
> name = fullStatus;
>  prototypeName = varchar16;
> },
>
> with the following error:
>
> IllegalStateException: sqlStringForAttribute: attempt to generate SQL for
> attribute 'fullStatus' on entity 'Party' with undefined column name. You
> must define a column name for this attribute before attempting a database
> operation.
>
> 2) The read format option didn't work either since the attribute is an
> integer number and the return value is a string. I attempted this format:
>
> if(%P,'Active','Inactive')
>
> and it resulted in this error:
>
> JDBCAdaptorException: Invalid value for getInt() - 'Inactive'
>
> However, this works just fine as a read format:
>
> if(%P,2*%P,5*%P)
>
> But I am stubborn and think that a derived attribute is a desirable
> attribute. I would like to use it for more complex operations, for example
> involving concatenation of strings in related entities.
>
> Anyway, trying to figure out what is happening, it occurred to me that my
> Party entity is a custom class, so I tried a non-custom class with a simple
> entity to see if the derived attribute would work. And it worked. My simple
> tentative entity is this:
>
> {
>     attributes = (
>         {columnName = code; name = code; prototypeName = intNumber; },
>         {
>             columnName = fullStatus;
>             definition = "case code when 0 then 'Active' when 1 then
> 'Inactive' end";
>             isReadOnly = Y;
>             name = fullStatus;
>             prototypeName = varchar16;
>             userInfo = {"_EntityModeler" = {generateSource = NO; }; };
>         },
>         {allowsNull = N; name = id; prototypeName = id; }
>     );
>     attributesUsedForLocking = (code, id);
>     className = "er.extensions.eof.ERXGenericRecord";
>     classProperties = (code, fullStatus);
>     externalName = Status;
>     fetchSpecificationDictionary = {};
>     name = Status;
>     primaryKeyAttributes = (id);
> }
>
> But this isn't a solution for me, since my entity will have a lot of
> business logic that demands a custom class. Perhaps I should set my Party
> entity as a ERXGenericRecord and then subclass it to implement the business
> logic.
>
> The question is, why does EO expect a column for a derived attribute for a
> custom class and not for a ERXGenericRecord?
>
> By the way, the original Apple EOModeler User Guide doesn't state that a
> derived attribute will not work for a custom class nor does the
> documentation states that a derived attribute should be modeled for a
> generic record.
>
> Angelo
>
> 2014-03-23 1:01 GMT-03:00 Aaron Rosenzweig <aa...@chatnbike.com>:
>
>> Hi Angelo,
>>
>> Couple things to try:
>>
>> 1) Remove the single apostrophes surrounding "status" and try again. It
>> is possible that it isn't parsing properly... don't column names need to have
>> "double apostrophes" ??? Perhaps MySQL is lax about that but still... Either
>> use no apostrophe or use a "double apostrophe" meaning a single character
>> the shift-apostrophe key. If it is a single apostrophe that is a String in
>> SQL.
>>
>> 2) Try a different way. Remove all the code you have in the derived part
>> and make this a normal EOAttribute. Put "STATUS" in there by itself. Now go
>> to the "advanced" tab and type what you want in the "Read Format" and check
>> the "read only" box. In the read format you want to use %P for your
>> columnName so you'll want something like this:
>>
>> case %P when 0 then 'Active' when 1 then 'Inactive' end
>>
>> Honestly, I almost always use the #2 way and never the "derived" way
>> because it is more flexible. I like the idea that I define the column in
>> one box and in another I write something complex but refer to it with %P.
>>
>> Try it out and report back.
>>   *Aaron Rosenzweig* / Chat 'n Bike <http://www.chatnbike.com/>
>> *e:*  aa...@chatnbike.com  *t:*  (301) 956-2319
>>
>>
>
>


-- 
Ângelo Andrade Cirino
aacir...@gmail.com
31-3494-8642
31-9303-0695
MSN aacir...@hotmail.com
Skype aacirino
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to