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
|
Hello there, In our database we have the following two quite simple tables: CLIENT and CLIENT_TYPE. We created the foreign key to CLIENT_TYPE and named it CLIENT_TYPE_ID. Now when I drag both tables to the designer it creates 2 "objects": Client and ClientType, sweeet, pretty cool that it made my (ugly) table names into nicer to read class names, so far so good. So now I start by doing simple queries like fetch all clients and fetching clients of a certain client type, and you guessed it, this error appears: Invalid Column Name: "ClientTypeId". Well duhhhhhhh even though the class is named ClientType the underlying foreign key is still named CLIENT_TYPE_ID why is it using the "class name" to infer the foreign key name when it knows that the column in the CLIENT table is named CLIENT_TYPE_ID ? I just don't understand this behavior, the database we have is (unfortunatly) a legacy schema we cannot change but would LOVE to have it work in LightSpeed. So renaming tables and column names is not an option. Having to adjust every ColumnName property on every association in the designer is not an option, mostly because of the sheer amount of time implied with it, and the horror of having to do it all over again when something does change in the schema using the conventions that are tied to it and then being forced to enter the ColumnName values all over again. I realise that LightSpeed 3 Designer is offering us a way "around" the issue but in my oppinion this should not be neccesary since LS3 is well aware of what the real column is and should be without trying to infer that from the entity class name it produces. I hope you can help us! :-) |
|
|
You are right, the designer should be setting the ColumnName automatically for you. We did have some bugs with this a little while back for the specific case of when the "nice" column name differed from the database column name only by underscores, which looks like it's what's happening in your case (ClientTypeId vs. CLIENT_TYPE_ID). These should be ironed out now. If you're not using a recent nightly build, try downloading the latest nightly and re-importing your tables using that. If that still doesn't work, could you let me know which database engine you are using, and provide me with CREATE TABLE scripts for the CLIENT and CLIENT_TYPE tables, and we will see if we can reproduce the problem and get it fixed for you. |
|