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:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 2:35 PM To: [email protected] Subject: Re: Add getHashCode() to CayenneDataObject? On Wed, 21 Jun 2006 14:15:29 -0400, Gentry, Michael (Contractor) <[EMAIL PROTECTED]> wrote: > The @For component can look something like this: > > <span jwcid="@For" 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="@ProductLink" parameters="ognl:@[EMAIL PROTECTED] (product)"> and: <img alt="product image" jwcid="[EMAIL PROTECTED]" 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
