RE: Add getHashCode() to CayenneDataObject?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Jun 21 2006 - 17:26:19 EDT

  • Next message: Andrus Adamchik (JIRA): "[JIRA] Created: (CAY-577) Automatically invalidating cached lists when Cayenne commits changes that can affect the list"

    Well, wasn't trying to turn this into a Tapestry or OGNL thing. After
    all, any web framework could require a unique ID of some kind and you
    might not want to expose the PK.

    As for keyExpression, I think it is a little bit different than a normal
    OGNL since Tapestry seems to be gluing it together. When I had
    "hashCode" in the expression, I got an OGNL exception because it
    couldn't find the method.

    I think I'll stick with my getHashCode() wrapper right now. My most
    complex application worked using it and it is generating nice bogus
    numbers for me. :-)

    Thanks!

    /dev/mrg

    -----Original Message-----
    From: Kevin Menard [mailto:kmenar..ervprise.com]
    Sent: Wednesday, June 21, 2006 2:35 PM
    To: cayenne-de..ncubator.apache.org
    Subject: Re: Add getHashCode() to CayenneDataObject?

    On Wed, 21 Jun 2006 14:15:29 -0400, Gentry, Michael (Contractor)
    <michael_gentr..anniemae.com> wrote:

    > The..or component can look something like this:
    >
    > <span jwcid=..or" source="ognl:lenders" value="ognl:currentLender"
    > keyExpression="objectId">

    I'm not familiar with keyExpression, but I think the handling of ognl is

    uniform throughout Tapestry.

    > If you aren't familiar with Tapestry, this means to loop over
    > getLenders(). Each iteration over the collection sets the value with
    > setCurrentLender(aLender). And the keyExpression becomes
    > getCurrentLender().getObjectId(). This works, but it serializes the
    > ObjectId for each row to the HTML. When I used "objectId.hashCode" it
    > was trying getCurrentLender().getObjectId().getHashCode(), which
    failed.
    > Of course, that would have the problem mentioned earlier (with nulls).

    Well, I have some example method calls here. I know the first one will

    make you cringe, but I'm not concerned with the PK being exposed in this

    case (read-only entries):

    <a href="#" jwcid=..roductLink"
    parameters="ognl..rg.objectstyle.cayenne.DataObjectUtils@intPKForObject
    (product)">

    and:

    <img alt="product image" jwcid="productImag..mage"
    image="ognl:product.getStoreImage(servletContext, webRequest,
    requestCycle)"/>

    Note the method arguments are exposed page properties.

    So, I see no real reason that you can't call whatever method you'd like.

    Off the cuff, it would seem that "objectId.hashCode()" would work.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Wed Jun 21 2006 - 17:26:45 EDT