Hi Ray,
Thanks for your response, and yes, I think you understand. I was hoping to not have to create a new table with just a boolean column along with a relationship and that I could somehow just store an array in one of the attribute fields directly for the same effect. I assumed that's what ERXMutableArray class was for. If not that, then what is it usually used for?

Thanks,
Jeff


On Apr 17, 2008, at 3:35 PM, [EMAIL PROTECTED] wrote:



-------- Original Message --------
Subject: ERXMutableArray fields in Entity Modeler
From: Jeff Schmitz <[EMAIL PROTECTED]>
Date: Thu, April 17, 2008 4:20 am
To: WebObjects Mailing List <[email protected]>

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?


<snip>

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.saveChang es();

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

I might be misunderstanding your question or what you are trying to do. But I think that you are not going to be able to do this as you describe.

The picture you show is for the Properties of an attribute value. In other words, if you are returning an array of booleans, then you somehow have a to-many relationship that is returning some number of value attributes. Those value attributes are of t ype boolean. The relationship is, in an object-oriented sense, an attribute also. But it is not a value attribute.

If you look at a relationship in a model, and look at its Properties, you will see what can be done with a relationship.

Does this make sense?

- ray

<erxmutablearray.jpg>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jeffandmonica%40mac.com

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to