You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Steve Lowery <sl...@gatessolutions.com> on 2011/08/15 16:50:15 UTC

serialization question

Is there a hook point to serialization of components?  We would like to
throw a WicketRuntimeException if we detect that we are about to attempt to
serialize out an attached (in our case Hibernate) entity rather than using a
LoadableDetachableModel and only serializing the id.  I see I can register
an DetachListener, but that doesn't fire until after the model is detached
and that doesn't help in these cases I think.  We have had issues where we
actually OOM the server when trying to serialize an entity that has LOTS of
associations.  I'd like to throw the exception before the serialization is
even attempted.

We are using wicket 1.4.17.

Re: serialization question

Posted by Martin Grigorov <mg...@apache.org>.
In Wicket 1.4 see org.apache.wicket.util.io.IObjectStreamFactory.
In Wicket 1.5 org.apache.wicket.serialize.ISerializer

On Mon, Aug 15, 2011 at 5:50 PM, Steve Lowery
<sl...@gatessolutions.com> wrote:
> Is there a hook point to serialization of components?  We would like to
> throw a WicketRuntimeException if we detect that we are about to attempt to
> serialize out an attached (in our case Hibernate) entity rather than using a
> LoadableDetachableModel and only serializing the id.  I see I can register
> an DetachListener, but that doesn't fire until after the model is detached
> and that doesn't help in these cases I think.  We have had issues where we
> actually OOM the server when trying to serialize an entity that has LOTS of
> associations.  I'd like to throw the exception before the serialization is
> even attempted.
>
> We are using wicket 1.4.17.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


RE: serialization question

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> Is there a hook point to serialization of components?  We would like to
> throw a WicketRuntimeException if we detect that we are about to attempt to
> serialize out an attached (in our case Hibernate) entity rather than using a
> LoadableDetachableModel and only serializing the id.

I usually solve that problem by having a "LDM-like" model that has a transient (thus not serialized) reference to the actual object, and a load()-method using the id to get the actual object if null. But: Since you are in control over what types of models are used in the code, how do you end up with models that reference Hibernate objects in a way that will try and serialize them?

- Tor Iver

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