Thanks for the tips.

Regards,
Harvey



On Apr 28, 2009, at 7:31 PM, M.Y. Tjoe wrote:

Hi all,

I am currently investigating an interesting problem. Here is the
problem description:

A database table "Person" is represented in EOModel as "Person" with
3 childs  "Staff" , "Student", "External". There is type column in
Person to tell if he is staff/student/external.

The problem is that when a "External" object is fetched into a ec,
changed its type to "student" and saved changes,

You cannot, may not, must not change the type of an object.  Look at a
Role pattern instead.

Chuck




i.e.

External external = External.fetchExternal(ec, External.ID_KEY,
'12345');
external.setType("student");
external.editingContext().saveChanges();

then in the same ec (or different ec) the now "student" still being
recognized as External somehow.

When you do

Student student = Student.fetchRequiredStudent(ec, Student.ID_KEY,
'12345');
or even
Person student = Person.fetchRequiredPerson(ec, Person.ID_KEY,
'12345');

An databaseContextFailedToFetchObject exception is thrown.

I am thinking the objects graph is now broken because Staff Object
supposed to be vanished from the graph but it didn't.

Any idea??

Regards,
Harvey

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [email protected]


--
Chuck Hill             Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to