You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim O'Callaghan <ji...@peritussolutions.com> on 2010/07/02 19:19:24 UTC

ajaxformloop query

I've been playing around with ajaxformloop for the guts of a day and am
having some issues with it I'm hoping someone can set me straight on.  I see
that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT) and
I'm getting "a different object with the same identifier value was already
associated with the session" from hibernate.  I've seen this before and am
familiar with the hibernate reason for it.  Can anyone point to a good
concise up to date example of using the ajaxformloop?   Is it necessary to
specify an encoder anymore?  Thanks.

 

Regards,

Jim. 


RE: ajaxformloop query

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
Josh, Thiago,

Thanks for the responses.  I can get around the hibernate issue by storing
my objects in a list persisted in the session (cleared when the page is
detached), and updating them with the ones from the form, but what I'm
trying to get at more is the correct approach to take regarding the
ajaxformloop - should I be using a temporary list for this kind of thing and
should I be using DefaultPrimaryKeyEncoder / PrimaryKeyEncoder for lookups
against my list, or are they deprecated and if so what is the preferred new
approach?  I see the relevant demo page uses @CommitAfter after updating the
form to get id creation triggered - my preference would be to use some
unique marker ids so the form can function and then blank them before
committing the whole transaction in onSuccess.  Thanks as always for your
helpful replies.

Regards,
Jim.

-----Original Message-----
From: Josh Canfield [mailto:joshcanfield@gmail.com] 
Sent: 02 July 2010 19:10
To: Tapestry users
Subject: Re: ajaxformloop query

> I'm getting "a different object with the same identifier value was already
> associated with the session" from hibernate.

When are you seeing the error? I don't use ajaxformloop but I'd guess
that your object is getting deserialized from the loop data stored in
the form.  Then you are trying to save the deserialized object instead
of the one that you probably looked up in the db from an event
method..

If you use a debugger you can trace the problem back by:
1. use a setter for your data object
2. set a break point in the setter
3. look at the stacktrace to see who's setting the value.

if you aren't using a debugger you can just dump the stack trace from
the setter.
new Throwable().getStackTrace();

Hope something in that is useful...
Josh

On Fri, Jul 2, 2010 at 10:19 AM, Jim O'Callaghan
<ji...@peritussolutions.com> wrote:
> I've been playing around with ajaxformloop for the guts of a day and am
> having some issues with it I'm hoping someone can set me straight on.  I
see
> that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT)
and
> I'm getting "a different object with the same identifier value was already
> associated with the session" from hibernate.  I've seen this before and am
> familiar with the hibernate reason for it.  Can anyone point to a good
> concise up to date example of using the ajaxformloop?   Is it necessary to
> specify an encoder anymore?  Thanks.
>
>
>
> Regards,
>
> Jim.
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ajaxformloop query

Posted by Josh Canfield <jo...@gmail.com>.
> I'm getting "a different object with the same identifier value was already
> associated with the session" from hibernate.

When are you seeing the error? I don't use ajaxformloop but I'd guess
that your object is getting deserialized from the loop data stored in
the form.  Then you are trying to save the deserialized object instead
of the one that you probably looked up in the db from an event
method..

If you use a debugger you can trace the problem back by:
1. use a setter for your data object
2. set a break point in the setter
3. look at the stacktrace to see who's setting the value.

if you aren't using a debugger you can just dump the stack trace from
the setter.
new Throwable().getStackTrace();

Hope something in that is useful...
Josh

On Fri, Jul 2, 2010 at 10:19 AM, Jim O'Callaghan
<ji...@peritussolutions.com> wrote:
> I've been playing around with ajaxformloop for the guts of a day and am
> having some issues with it I'm hoping someone can set me straight on.  I see
> that DefaultPrimaryKeyEncoder is deprecated (I'm using T5.2.0-SNAPSHOT) and
> I'm getting "a different object with the same identifier value was already
> associated with the session" from hibernate.  I've seen this before and am
> familiar with the hibernate reason for it.  Can anyone point to a good
> concise up to date example of using the ajaxformloop?   Is it necessary to
> specify an encoder anymore?  Thanks.
>
>
>
> Regards,
>
> Jim.
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ajaxformloop query

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 02 Jul 2010 14:19:24 -0300, Jim O'Callaghan  
<ji...@peritussolutions.com> wrote:

> I've been playing around with ajaxformloop for the guts of a day and am
> having some issues with it I'm hoping someone can set me straight on.  I  
> see that DefaultPrimaryKeyEncoder is deprecated (I'm using  
> T5.2.0-SNAPSHOT) and I'm getting "a different object with the same  
> identifier value was already associated with the session" from  
> hibernate.  I've seen this before and am familiar with the hibernate  
> reason for it.  Can anyone point to a good
> concise up to date example of using the ajaxformloop?   Is it necessary  
> to specify an encoder anymore?  Thanks.

You're having a pure Hibernate issue, not related to Tapestry. By any  
chance are you using Session.update()? User Session.merge() instead.

-- 
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org