This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm getting weird errors with LightSpeed 3 and composite keys. I tried the lastest nightly build, but no luck. I used the article http://www.mindscape.co.nz/blog/index.php/2009/12/22/composite-keys-in-lightspeed-3, but that also doesn't work. I have attached my project so you can see it in action. The database schema may look funky because there is no relationship to the permissions table, but that is how the database schema I'm working with is as well so just ignore that. |
|
|
The error occurs because you are not setting the Account and User associations on UsersAccount. As far as LightSpeed is concerned, the UserId and AccountId in the UsersAccountId CK struct are entirely independent of the UserId and AccountId of the UsersAccount class: setting the UsersAccountId.UserId does *not* set the UsersAccount.UserId or the UsersAccount.User. LightSpeed does not directly support associations based on parts of composite keys (though it is something a lot of customers seem to be running into so we will probably look at improving this). See http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2447&PostID=7155 and http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=2911 for how to work around this. Better still, if you have the option to extend the database schema, add an Id column to the UsersAccounts table, make that (alone) the primary key, and demote UserId and AccountId to plain old foreign keys. Then you will not only be able to use standard LightSpeed associations but you will be able to represent the User/Account relationship directly as a through association, which is much more convenient to work with! |
|
|
Thank you for getting back to me! I can not change the schema. I will try the suggestions you have offered. I would think this is a pretty common scenario considering almost every database I've worked on has used this practice. |
|
|
We have now implemented experimental support for this. Please see http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2990&PostID=9499 and give us your feedback! Thanks! |
|