On Wed, Jun 16, 2010 at 12:18 PM, Jim O'Callaghan <jc1000...@yahoo.co.uk> wrote: > Thiago, given that approach, where an entity with structure (Long id, String > desc) is being translated, would you mind suggesting the best approach to > access the id of my entity <not the field id or tapestry id> from within the > parseClient method of the relevant translator? I had a look through the > 5.1.0.5 sources and nothing jumped out. I was thinking of putting a method > on the translator to set a local var (to hold the id) and setting it from the > AppPropertyEditBlocks getXXXTranslator, or even putting something in a > threadlocal, but if there is a better / safer way I would be interested to > hear it, or to hear if this approach is not suitable for my use case. > Getting the client value (the entity's desc field) back in parseClient is > working correctly, but if I don’t have the existing entity id my persistence > layer assigns a new one. >
Are you using Hibernate? If so: ClassMetadata metadata = sessionFactory.getClassMetadata(entity.getClass()); Serializable identifier = metadata.getIdentifier(entity, EntityMode.POJO); (From Tynamo's SeedEntityImpl) Kalle > -----Original Message----- > From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] > Sent: 16 June 2010 19:09 > To: Tapestry users > Subject: Re: Custom Edit Block > > On Wed, 16 Jun 2010 14:52:55 -0300, Christophe Cordenier > <christophe.corden...@gmail.com> wrote: > >> Another elegant way is maybe to decorate the BeanModelSource to detect >> entities and set a special datatype in case of 'id' property. Anyway i >> dind't make the test. > > I still prefer the DataTypeAnalyzer route. That's the normal, expected > path. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informa��o Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org