This solved it for me.... Thank you!

In addition, I'll remove the class property attribute for all foreign keys.

I just switched from Xcode to WOLips this weekend. Surprisingly, it is actually helping me get a better understanding of what is going on and how it all works... and exposing my own problems with my code :-)

Thanks again,
Tarun

On Aug 27, 2006, at 2:29 PM, James Cicenia wrote:

put the ec.insertObject(newOrg) immediately after creating it. 

never stray from that advice or use EOUtilities.createAndInsert....

- j -

On Aug 27, 2006, at 2:50 PM, Tarun Reddy wrote:

I have a simple application with a User and an Organization.

They look something like this

VaultUser
user_oid (primary)
login (not null)
org_oid (not null)

Organization
org_oid (primary)
org_name (not null)


I have set up the relationships correctly in EOModeler and it seems like it should all work.

In my code, I set up the relationship like such:

newOrg = new Organization();
newOrg.setOrgName(orgName);
newUser = new VaultUser();
newUser.setLogin(login);
newUser.setPassword(password);

// newOrg.addToVaultusers(newUser);
// newUser.setOrganization(newOrg);
ec.insertObject(newOrg);
ec.insertObject(newUser);
newOrg.addObjectToBothSidesOfRelationshipWithKey(newUser, "vaultusers");

// save changes permanently in database
ec.saveChanges();


This returns an error that says VaultUser could not be saved since org_oid cannot be null. If I change org_oid so that it can be null, everything works fine (and the data is accurately filled in), but it isn't a really accurate model of the relationship. Do I just have to go with this workaround, or am I adding the relationship in java incorrectly?

Thanks in advance,
Tarun





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

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