RE: To severe things

From: Chris Farnham (cfarnha..ra.com)
Date: Fri Nov 23 2007 - 13:46:00 EST

  • Next message: Richie Alford: "Cayenne and Axis 2"

    Jan,

    You may have already fixed your problem (1) detailed below but I thought
    you may like to know that I had the exact same problem and I was able to
    fix it.

    I added 'deleteRule="Nullify"' to my 'Evidence->User' relationship which
    seems very much like your Notiz->Person relationship.

            <obj-relationship name="user" source="EvidenceDAO"
    deleteRule="Nullify"
                    target="UserDAO" db-relationship-path="evidence_to_user"
    />

    This change to the xml mapping file (which I maintain by hand) fixed the
    NullPointerException I was receiving.

    Christopher Farnham
    Senior Software Engineer
    Decision Management Division
    cfarnha..ra.com
    617.491.3474 x562

    Charles River Analytics
    625 Mount Auburn Street
    Cambridge, MA 02138
    http://www.cra.com
    >
     
     
     
     
    THIS MESSAGE IS INTENDED FOR THE USE OF THE PERSON TO WHOM IT IS ADDRESSED. IT MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.
     
    -----Original Message-----
     
     

    > From: Jan Lendholt [mailto:jlendhol..otmail.com]
    > Sent: Friday, September 14, 2007 7:59 AM
    > To: use..ayenne.apache.org
    > Subject: Re: To severe things
    >
    > Hi Kevin,
    >
    > To (1):
    >
    > two snippets I can give you. Unfortunately we do not have a fitting
    test
    > case.
    >
    > The "faulty" object is stored in a list and the delete via
    > context.deleteObject:
    >
    > //Thios expression fetches all persons that should be deleted from a
    note
    > Expression delExp =
    > ExpressionFactory.matchExp(Mappingnotizperson.TO_NOTIZ_PROPERTY,
    >
    notiz.getObjectId()).andExp(ExpressionFactory.matchExp(Mappingnotizperso
    n.
    > TO_PERSONEN_PROPERTY,
    > each.getObjectId()));
    >
    > SelectQuery selQ = new
    > SelectQuery(Mappingnotizperson.class,delExp);
    >
    > //perform the query
    > List<Mappingnotizperson> m = this.context.performQuery(selQ);
    > //Delete the object
    > this.context.deleteObject(m.get(0));
    > this.context.commitChanges();
    >
    > Now the corresponding object is marked as transient and is deleted.
    >
    > //This refetches all persons that are assigned to one note.
    > List<Mappingnotizperson> mapList =
    > this.notiz.getMappingnotizpersonArray();
    > System.err.println("notizid:"+
    notizShow.getObjectId());
    > for (Mappingnotizperson mappingnotizperson :
    mapList) {
    > System.err.println("mapp: pers-state:" +
    > mappingnotizperson.getPersistenceState()); // + " --- persid:" +
    > mappingnotizperson.getToPersonen());
    >
    > this.persList.add(mappingnotizperson.getToPersonen()); //**
    >
    > this.existPers.add(mappingnotizperson.getToPersonen());
    > }
    >
    > ** Here we get the NullPointerException that tells us, that the person
    of
    > this mapping is null.
    >
    > Hope you can start with what we've got.
    >
    > To (2):
    >
    > We're using cayenne 2.0.3 with a customized db adapter to be used with
    max
    > db.
    >
    > To me, the method prepareForAccess makes no sense.
    > At first it's checked againstz being hollow and afterwards it's
    checked
    > against being commited - but how should it be commited when it's
    already
    > hollow??
    >
    > Thanks in advance guys.
    >
    > Jan
    >
    >
    >
    > >From: Kevin Menard <kmenar..ervprise.com>
    > >Reply-To: use..ayenne.apache.org
    > >To: <use..ayenne.apache.org>
    > >Subject: Re: To severe things
    > >Date: Thu, 13 Sep 2007 15:21:52 -0400
    > >
    > >Hi Jan,
    > >
    > >I'm snipping out a lot of just to get to a few basic questions I
    have.
    > >
    > >
    > >On 9/13/07 1:25 PM, "Jan Lendholt" <jlendhol..otmail.com> wrote:
    > >
    > > > Well, this exception comes on an object with the PersistenceState
    =
    > > > Transient. The exception is thrown when in doResolveFault cayenne
    > tries
    > >to
    > > > access the object's context.
    > > > But why? This object shouldn't even be there! In my opinion this
    is a
    > >bug.
    > > > It doesn't matter, if we delete the object with deletObject or
    with a
    > >delet
    > > > query. How can it be? It's pretty severe though.
    > >
    > >If possible, could you please post the code that seems to trigger the
    > >error?
    > >A small test case would be perfect, but showing anything would be
    > helpful.
    > >
    > > > (2)
    > > > I try to access a mapping table again, this time we manage
    resources
    > >like
    > > > rooms, beamers etc.
    > > >
    > > > I get all mappings and try to access via
    > >mapping.getToResource().getname()
    > > > the resource's name.
    > > >
    > > > We get:
    > > >
    > > > 19:22:49.168 WARN!! Exception for /ams?serviceId=Echo.Synchronize
    > > > org.apache.cayenne.FaultFailureException: [v..AYENNE_VERSION@
    > > >..AYENNE_BUILD_DATE@] Error resolving fault for ObjectId:
    > > > <ObjectId:Resource, IDRESOURCE=1> and state (hollow). Possible
    cause -
    > > > matching row is missing from the database.
    > >
    > >What version of Cayenne are you actually using?
    > >
    > >--
    > >Kevin
    > >
    >
    > _________________________________________________________________
    > Haben Spinnen Ohren? Finden Sie es heraus - mit dem MSN Suche
    Superquiz
    > via
    > http://www.msn-superquiz.de Jetzt mitmachen und gewinnen!



    This archive was generated by hypermail 2.0.0 : Fri Nov 23 2007 - 13:46:37 EST