Re: Inheritance Problem
Re: Inheritance Problem
- Subject: Re: Inheritance Problem
- From: Chuck Hill <email@hidden>
- Date: Tue, 16 May 2006 11:46:27 -0700
Hi David,
I am not too clear on our inheritance configuration from your
message. Two possibilities jump to mind.
1. If you have the sub-entities in their own tables, then you can't
enforce foreign-key constraints. i.e. If you have a Person entity in
a Person table and an Employee entity in a Employee table, then you
can't enforce a foreign-key constraint from Department to Person as
the rows will actually be in the Employee table. The solution to
this is to remove the impossible foreign-key constraints.
2. EOF often performs operations on the database in an order other
than what you might desire. For example, it may insert a row into
the Employee table before inserting the corresponding row into the
Department table (assuming you are creating a new Department and
Employee in the same transaction). There are two solutions to this.
If you are using a real database (e.g. whOracle, FrontBase,
PostgreSQL) then generate the foreign-key constraints with DEFERRABLE
INITIALLY DEFERRED. This will cause the database to check integrity
when the COMMIT is issued instead of checking it after every
statement is executed. With the proper EOModeler plugin (which is
different than the EOF plugin), this SQL should be generated
automatically.
If you are using MySQLToy or something else that does not support
DEFERRABLE INITIALLY DEFERRED, there is a delegate of
EOAdaptorChannel that you can use to order the operations in code.
Project Wonder has an implementation of this. I have never used it,
so have no more information on it.
Chuck
On May 16, 2006, at 8:25 AM, David Avendasora wrote:
Hi all,
I am trying to save an instance of a subclass to the database after
creating it from scratch. I am getting a foreign-key constraint
error from the database because it hasn't created the database
record for the parent class yet, which has a one-to-one
relationship configured in the database.
I've recreated the relationship in the DB and in EOModeler just to
make sure I had done it correctly, but I'm still getting the same
error.
Any ideas? Am I missing something obvious?
Thanks,
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden