Re: ERXMutableArray fields in Entity Modeler
Re: ERXMutableArray fields in Entity Modeler
- Subject: Re: ERXMutableArray fields in Entity Modeler
- From: "Denis Frolov" <email@hidden>
- Date: Fri, 18 Apr 2008 10:26:52 +0400
Hi,
I had a similar problem with MySQL (mysql-connector-java-5.0.4-bin.jar
is the latest one I've tried) and mutableDictionary. There were two
solutions that worked for me:
1. Change externalType to TEXT in model while leaving BLOB in the
database (i.e. generate sql with TEXT and change type to BLOB after
that).
2. Modify generator templates to have something like:
public er.extensions.ERXMutableDictionary uploadsFileNames() {
try {
return (er.extensions.ERXMutableDictionary)
storedValueForKey("uploadsFileNames");
} catch (ClassCastException e) {
return (ERXMutableDictionary)
ERXMutableDictionary.fromBlob((NSData)
storedValueForKey("uploadsFileNames"));
}
}
Both solutions are really dirty and can lead to unwanted side effects,
so I've decided that it really doesn't worth the effort and refactored
my model not to use these prototypes at all.
You might also want to check this thread:
http://www.wodeveloper.com/omniLists/webobjects-dev/2004/March/msg00340.html
On Thu, Apr 17, 2008 at 3:20 PM, Jeff Schmitz <email@hidden> wrote:
> Hello,
>
> I've taken Dave's SooperSeekrit Screencast project as a starting point to
> start playing with EO objects using the Wonder Framework.
>
> Using Entity Modeler (with Frontbase prototypes), I've added an
> ERXMutableArray to one of my classes that I want to use as an array of
> Boolean's in my code. In this case, what do I need to put as the Value
> Type? Also, for the width, will it be 4 bytes X the max number of Booleans
> to be stored?
>
>
>
> I have tried just leaving these fields blank.
>
>
> Then using the following code, I'm able to create a User object ok, and it
> shows up in my database with the Boolean array as a Blob:
>
>
> Group group = Group.fetchRequiredGroup(ec, "name", "user");
> Boolean [] bools = {true, false, true};
> ERXMutableArray boolArray = new ERXMutableArray(bools);
> User.createUser(ec, boolArray, first, last, password, newuser, group);
> ec.saveChanges();
>
> However, when I try to a fetch from the DirectAction class as follows:
>
>
> EOQualifier qual =
> User.USERNAME.eq(username).and(User.PASSWORD.eq(password));
> User user = User.fetchRequiredUser(ERXEC.newEditingContext(), qual);
>
>
> I get the following exception on the User.fetchRequiredUser line:
>
>
> Apr 16 22:31:32 SooperSeekrit[49595] (ERXDatabaseContextDelegate.java:105)
> INFO er.transaction.adaptor.Exceptions - Database Exception occured:
> java.lang.ClassCastException: er.extensions.ERXMutableArray
>
> I'm guessing it has to do with the missing fields?
>
> Thanks,
> Jeff
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden