Re: Weird Behaviour with Nullify rule

From: Jorge Sopena (jsopen..idsa.es)
Date: Fri Oct 22 2004 - 04:57:34 EDT

  • Next message: Mike Kienenberger: "Re: Query certain attributes"

    Thanks Andrus,
    This is the problem.
    In my example, if I change "new Long(pk)" with "new Integer(pk)"
    everything works, but I've got another cases where I don't search the
    new object for his PK, so I keep having the problem.

    My DB(Mysql) has all PK as BIGINT so I need a Long type, but ObjectId
    created by Cayenne uses Integer.
    I've changed PKs in DB to Integer and all the situations work correctly.
    In fact, I've realised that "AutoPK support" works with Integer so I'd
    have never taken advantage of Bigint type.

    BTW, if you could select the type in "AutoPK support" and this selection
    were considered in the creation of ObjectIds, for example having
    different constructors for ObjectId. This would add a bit more
    flexibility to the modeler, although It would't solve the problem when
    you don't use "AutoPk support".

    Anyway, I'll keep my attention int the issue CAY-191.

    -Jorge

    Andrus Adamchik wrote:

    > Hi Jorge,
    >
    > On Oct 21, 2004, at 11:15 AM, Jorge Sopena wrote:
    >
    >> I receive the PK for this path and search the object:
    >> Path path =
    >> (Path)DataObjectUtils.objectForPK(dataContext,Path.class,new Long(pk));
    >> //I see the query in the log
    >
    >
    > That line already looks weird... As your Path object is in memory,
    > there shouldn't be a query, and a cached object should be used. So at
    > this point things have already gone wrong... :-/
    >
    > It is very likely that ObjectId for Path created via Cayenne uses
    > "Integer" for id, not "Long"... I may need to check that. We already
    > have a bug report showing how different data types in joins can lead
    > to inconsistencies
    > (http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-191), this
    > could be something similar. So if you replace "new Long(pk)" with "new
    > Integer(pk)", does it change anything?
    >
    > BTW, I am still undecided on the best way to fix CAY-191 and generally
    > make ObjectId type-agnostic without sacrificing too much performance...
    >
    > Andrus
    >

    -- 
    ==============================================================
    Jorge Sopena Torres
    SIDSA
    (Semiconductores Investigación y Diseño, S.A.)
    

    Parque Tecnológico de Madrid c/ Torres Quevedo, nº 1 28760 TRES CANTOS (Madrid) (SPAIN)

    Phone : +34 91 803 5052 Fax: +34 91 803 9557

    e-mail: jsopen..idsa.es URL: http://www.sidsa.com

    ==============================================================



    This archive was generated by hypermail 2.0.0 : Fri Oct 22 2004 - 04:49:26 EDT