You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Troy Cauble <tr...@gmail.com> on 2009/09/10 04:15:06 UTC

multiple changes vs. session-per-request

I have a database entity that refers to a collection of non-entity components.

@Entity
class A {
     @CollectionOfElements
     Collection<String> b = new ArrayList<String>();
}

I'm running session-per-request and I really don't want to change that.

I have a Form where b strings can be added and deleted.
The desire is to support multiple adds and deletes before a final save
for the entity A.

But each b-string add and delete is a round trip and reloading the
LDM for A wipes the changes to the b-list.

I could keep a reference to the entity, but it's been written
"never keep direct references to hibernate entities".

What are my other options?  Is there a way to keep multiple adds
and deletes in the client until "save"?  Should I maintain a list of
edits and combine them with the b-list on render?

Have I missed something more straightforward (other than
session-per-conversation)?

Thanks,
-troy

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


Re: multiple changes vs. session-per-request

Posted by James Carman <jc...@carmanconsulting.com>.
Add them to a List that you keep and then when you're done, dump that
list into the entity?

On Wed, Sep 9, 2009 at 10:15 PM, Troy Cauble<tr...@gmail.com> wrote:
> I have a database entity that refers to a collection of non-entity components.
>
> @Entity
> class A {
>     @CollectionOfElements
>     Collection<String> b = new ArrayList<String>();
> }
>
> I'm running session-per-request and I really don't want to change that.
>
> I have a Form where b strings can be added and deleted.
> The desire is to support multiple adds and deletes before a final save
> for the entity A.
>
> But each b-string add and delete is a round trip and reloading the
> LDM for A wipes the changes to the b-list.
>
> I could keep a reference to the entity, but it's been written
> "never keep direct references to hibernate entities".
>
> What are my other options?  Is there a way to keep multiple adds
> and deletes in the client until "save"?  Should I maintain a list of
> edits and combine them with the b-list on render?
>
> Have I missed something more straightforward (other than
> session-per-conversation)?
>
> Thanks,
> -troy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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