EOF looks at it a different way, and I can understand their approach.  If you had a foreign key to the other table in your table, and it was NULL, then it's ok if the relationship is not mandatory.  In their eyes, since you happen to use the same primary key for both objects, it figures it MUST be there, because the key has a value.

There are ways to use delegation (can't remember which delegate) to catch the fault firing, and if you don't find the object, return null instead of a blank one.  I've done that before...

Ken

On Jul 25, 2006, at 11:20 AM, Watkins, Garry wrote:

Really not the answer that I wanted.  Personally, I think that it is a bug in EO, if the relationship is defined as NOT mandatory, and it encounters a EOObjectNotAvailableException it should return null.  However, I want to continue to use EOGenericRecords since it is mainly a reporting type application.  Does anyone know where the Fault is triggered inside the EO stack so that I might be able to trap the operation with AspectJ?  This would also require that I have the EORelationship that triggered the fault.
 
Thanks
Garry

From: Ken Anderson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 25, 2006 11:08 AM
To: Watkins, Garry
Cc: webobjects-dev@lists.apple.com
Subject: Re: EOObjectNotAvailableException

Garry,

EOF is not happy with such situations - if the key is not null, it expects the to-one to exist.

There are a few workarounds - the simplest is to turn the relationship into a to-many and check the object count before returning null or the one object in the array.

Ken

On Jul 25, 2006, at 10:57 AM, Watkins, Garry wrote:

I am getting EOObjectNotAvailableException when I have optional relationships that are linked by a primary key.  I do not control the data entry that is associated with these records, so I cannot automatically create empty ones  Is there a way for me to trap these exceptions and just get a null back.
 
This is a run down of my scenario:
 
I have Client, ClientExtensionAsbestos, ClientExtensionSilica entities.  They all have a primary key of A_Client.  Both of the Extension entities are optional depending on the clients case type.  A client may have one or more extension records but they are all optional relationships.  If I trigger the fault extensionSilica (or any other extension) and it does not exist, I want to receive null back.
 
Any pointers would be appreciated.
 
Thanks,
Garry

 

Confidential & Privileged

Unless otherwise indicated or obvious from its nature, the information contained in this communication is attorney-client privileged and confidential information/work product. This communication is intended for the use of the individual or entity named above.  If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error or are not sure whether it is privileged, please immediately notify us by return e-mail and destroy any copies--electronic, paper or otherwise--which you may have of this communication.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 

Confidential & Privileged

Unless otherwise indicated or obvious from its nature, the information contained in this communication is attorney-client privileged and confidential information/work product. This communication is intended for the use of the individual or entity named above.  If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error or are not sure whether it is privileged, please immediately notify us by return e-mail and destroy any copies--electronic, paper or otherwise--which you may have of this communication.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

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

This email sent to archive@mail-archive.com

Reply via email to