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: I have a sample application using inheritance and it appears the table inserts are being reversed and causing a violation of my constraints. Basically, I have an Objects table and a derived People table. I used the following code to create a new Person entity. Person myPerson = new Person(); ... Upon saving changes I get an exception saying that my Person_Object_FK is violated, basically saying that it can not create the Person without an entry in the Objects table. A dump of the SQL reveils: A first chance exception of type 'Oracle.DataAccess.Client.OracleException' occurred in Mindscape.LightSpeed.dll INSERT INTO PEOPLE INSERT INTO OBJECTS END; Why is it attempting to create the Person entry prior to creating the Object entry?
|
|
|
Class table inheritance doesn't currently support foreign key constraints between the IDs of the various tables. Sorry. |
|
|
Hi Ivan: For now we've dropped the FK constraint on the derived tables. Is support for FK constraints between the IDs of the various tables in the works? Or maybe my inheritance model is incorrect. Is there way to do inheritance in LightSpeed and ensure that derived table have entries in the base table? Here's an example of my tables: create table Objects create table People alter table People add constraint person_object_fk foreign key(id) references Objects(id);
|
|
|
We're not working on making class table inheritance FK-friendly at the moment, but you're not the first person to ask for this, so we'll try to bump it up the priority list. I can't make any promises though. Your inheritance model is perfectly correct, it's just that our implementation happens to work in a way that is FK-unfriendly. The constraint that entries in the derived tables have corresponding entries in the base table is ensured by LightSpeed (all inserts are done in a transaction). I appreciate that you'd like the additional guarantee of a database constraint though. |
|