The problem you are facing is due to the nature tapestry works (the
rewind-cycle). There is documentation online, you might read it to
understand this behaviour and to solve it without a persistent
attribute.

In short: when the page renders you have your data, when you submit a
form rewinding of the exact same form takes place. If your attribute is
not persistent it might be gone by now (unless you recreate it from
database for example). There are different strategies for solving this
problem, RTFM ;-)


Cheers,
detlef



-----Original Message-----
From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] 
Sent: Montag, 21. August 2006 14:01
To: Tapestry users
Subject: Re: Tapestry with Hibernate vs JSF with Hibernate (Object
binding question)

Sorry for the delay. Well, object equals and hashcodes are fully
implemented. What solved the problem was setting the property
persistent, which I really did no liked :(

When using a volatile property, tapestry is overwriting the objects,
by fresh new ones, filled only with forms values (as I said, there are
some properties that are not displayed for the user but important).

When switch to a persistent object (session bound) it preserves the
values, changing only the ones that changed

This is kinda awkward, I solved using a persistent strategy due the
lack of time of the project, but I really would like to check it
deeper, as I'd not like to have a lot of objects floating around my
session.

Best regards

On 8/19/06, Ryan Holmes <[EMAIL PROTECTED]> wrote:
> Just to clarify, Tapestry does not overwrite bound objects with new
> instances. iow, if a bound value is a Hibernate proxy, that's what
> you'll get -- for better or worse ;)
>
> -Ryan
>
> On Aug 19, 2006, at 7:20 AM, Vinicius Carvalho wrote:
>
> > Hello there! As I said on previous emails, I'm migrating a JSF app
to
> > tapestry, I'm about to finish. One thing that is really tricking me
is
> > the way that the Hibernate entities are bound on both frameworks (I
> > might being doing something wrong here).
> >
> > My edit page has an object (Event) that has a many-to-one
relationship
> > to User, so on the same screen I add/edit an user and an event.
> >
> > Well on the JSF, when I hit the service  layer (both apps share the
> > same model desing, with same entities and spring transaction managed
> > classes) the Event has an user (that is a EnhancedByCGLIB user) with
> > all it's original values (even those that are not displayed to the
> > user on the screen), so calling: eventDAO.update(event), updates my
> > user as well.
> >
> > On Tapestry side, hitting the service layer, the Event has a User
> > (POJO) and all other values have just gone, it seems that tapestry,
> > when binding it's values it does something like this:
> >
> > User user = new User();
> > ... //set properties present on the screen, dump all other from
> > database
> > event.setUser(user);
> >
> > This not only mess my database, but also makes hibernate to create a
> > new user for my event, instead of updating an existing one.
> >
> > Well, I'm pretty sure I'm doing stupid things here, could anyone
> > help me out?
> >
> > Best Regards
> >
> > Vinicius
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> Ryan Holmes, CISSP
>
> [EMAIL PROTECTED]
> ph. (213) 626-0026
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to