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 have tables transaction, and transaction_cash_deposit. transaction's primary key column is called id_transaction, and transaction_cash deposit's primary key column is also a foreign key on transaction's primary key, with the same name (id_transaction). when I try to insert a row into transaction_cash_deposit, it wants to insert that column as IdTransactionId. I have been through all the properties on the model, and in the .cs file for it, and I can't find where it's using that name. I found some references to IdTransactionId in the TransactionCashDeposit class, but I changed them to id_transaction, and it still does the same thing. I'm running out of ideas here, so any help would be greatly appreciated. |
|
|
It sounds like you have an association from TransactionCashDeposit to Transaction named IdTransaction. When you have an association named Xxx, this implicitly creates a foreign key field named XxxId -- in your case, IdTransactionId. But you don't want that implicit foreign key field: you want the foreign key to be the Id property. To do this, select the association in the designer, go to the Properties window and set the Key Property Reference to Id. If this doesn't help, or you need more info, please post the model and .cs file, and ideally the CREATE TABLE statements for the transaction and transaction_cash_deposit tables and the INSERT statement generated by LightSpeed. |
|
|
That solved one problem, but now I have a new one. Now when I try to insert the records, it throws a LightSpeedException is thrown with the message: "You are trying to insert an entity with no values and the provider does not support a default values syntax" I have stripped down the code so that the only thing it is trying to insert is the transaction record. The only SQL emitted by the connector is to insert the transaction record, which appears valid, but I'm still getting this exception, and there seems to be no way to tell which entity is triggering the exception. |
|
|
Hi Elkvis, Can you provide some more details on your model? Do you have any entities in your model which only have an Id and relationship fields to other tables (such as many to many through tables) and are you using automatic sequence for your identities?
Jeremy |
|