Re: Saving entities problem [SOLVED]
Re: Saving entities problem [SOLVED]
- Subject: Re: Saving entities problem [SOLVED]
- From: Jevon Hills <email@hidden>
- Date: Thu, 31 Jul 2003 11:01:09 -0600
These two lines:
aUsers.addObjectToBothSidesOfRelationshipWithKey(mlp,
"flt_applications");
aUsers.addObjectToBothSidesOfRelationshipWithKey(canUse,
"flt_permissions");
generate the following sql which does not seem to make sense.
"SELECT t0.BAID, t0.expirationDate, t0.password, t0.userID,
t0.userName
FROM dbo.Users t0, dbo.Applications T2,
dbo.UserApplicationPermission T1
WHERE T2.applicationID = ?
AND T1.applicationID = T2.applicationID
AND t0.userID = T1.userID"
withBindings: 1:6(applicationid)>
Same again:
"SELECT t0.BAID, t0.expirationDate, t0.password, t0.userID,
t0.userName
FROM dbo.Users t0, dbo.Permission T2, dbo.UserApplicationPermission
T1
WHERE T2.permissionID = ?
AND T1.permissionID = T2.permissionID
AND t0.userID = T1.userID"
withBindings: 1:8010(permissionid)>
As the records, have not been placed in the database there is no userid
in the UserApplicationPermission Table that will match the 3rd where
clause. The bindings id's are correct, but perhaps I'm missing
somthing, or not understanding. If i was to run these queries I would
get 0 records.
Shouldn't these be, insert statments??
I have set the relationships to propagate the primary key's for all
three entities, and set to cascade as well. What am I missing???? ;-(
Jevon
On Tuesday, July 29, 2003, at 03:39 PM, Art Isbell wrote:
> On Tuesday, July 29, 2003, at 11:11 AM, Jevon Hills wrote:
>
>> The UserApplicationPermission table has the 3 columns you'd expect
>> plus a column called uapID with is the PK of the table.
>
> This may be the problem. The 3 attributes should all be part of the
> primary key. There's no need for uapID if you want this entity to be
> a typical join entity. The values for the 3 primary key attributes
> will be propagated from the 3 entities that are joined assuming that
> the to-many relationships from the 3 entities to
> UserApplicationPermission are configured to propagate the primary key
> which is what EOModeler does when it joins two entities in a
> many-to-many relationship.
>
>> POSSIBILITIES: As I'm takin' shots at this the key that I'm using
>> for the addObjectToBothSidesOfRelationshipWithKey() method is the
>> name of the flattened relationship in the User entity.
>> (i.e. aUser.addObjectToBothSidesOfRelationshipWithKey(anApp,
>> "fltn_application");) Is This Correct??
>
> That should be correct.
>
>> As far as the Join table goes. Does having a 'rowid' PK on the table
>> have an impact on this situation?
>
> See above.
>
>> I am using 'this.session().defaultEditingContext().saveChanges();' to
>> save my changes, is this correct? Or do I retrieve the User obj's
>> EditingContext and use that? If the latter how to I get the User
>> obj's EditingContext?
>
> You can ask any object for its editing context by sending it an
> editingContext() message. Are you using multiple editing contexts?
> If so, you'll need to make local instances of all objects in the
> editing context being saved. If you don't, an exception will be
> thrown, so that's apparently not happening to you.
>
> Aloha,
> Art
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
>
>
Jevon K. Hills
Developer - Zymeta Media Promotion Systems
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.