Hi!
I have some problem to a to-one relationship.
I have an Entity with 3 properties ( color, brand, model) and one
relationship Responsable,

When i make a fetch, i'm able to access to all propeties, but i can't access
to relation responsable.
Here is the code

        String imm = vehicule.immatriculation();  //Access OK
        String marque = vehicule.marque(); //Access OK
        String modele = vehicule.modele(); //Access OK

When i do
    Responsable resp = vehicule.responsable(); i have a
_objectFaultWithSnapshotRelationshipEditingContext exception.

In the WebObject Entreprise Objects Programming Guide, it is written that
the fault is fired when the relationship's data is needed.

But when i do the following, i still have the same
_objectFaultWithSnapshotRelationshipEditingContext exception.

        String name= vehicule.responsable().name();
        String firstname= vehicule.responsable().firstname();

It is also written to call willRead() before accessing to the relationship's
data.

So i did:
          vehicule.willRead();
            String name= vehicule.responsable().name();
        String firstname= vehicule.responsable().firstname();

But it doesn't work. Same exception

After that, in Vehicule.java i did the following as suggested in the doc:

public class Vehicule extends _Vehicule {
    @SuppressWarnings("unused")
    private static Logger log = Logger.getLogger(Vehicule.class);

     public com.package.Responsable responsable() {
         willRead();
            return super.responsable();
     }

        public static boolean usesDeferredFaultCreation() {

            return true;

        }
}

I made sure the my model is valid and that data in the database are well
set.

Can you tell me please if i'm using willRead the right way? How can i access
to this relationship?

Thank you very much!

Fred
 _______________________________________________
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