Re: Today's installment of "well, duh." Was: Re: only 1 version of page in the cache at a time?

2007-11-27 Thread Evan Chooly
I actually *do* have that, but this code recently went through some ...
surgery that left things in a rather sloppy state.  Clearly not the most
prize worthy section of code.  :)

On Nov 27, 2007 10:43 PM, Timo Rantalaiho <[EMAIL PROTECTED]> wrote:

> On Tue, 27 Nov 2007, Evan Chooly wrote:
> > So here's the skinny:  while my subclass was marked as serializable, the
> > parent class was not.  So no state from the parent class got serialized
> nor,
> > not so surprisingly, deserialized.  After adding that implements clause
> > things miraculously started working.  So a big "you idiot" for me and a
> big
> > thanks to igor for pointing me to the Objects.cloneObject() method to
> help
> > write unit tests to highlight my otherwise obvious error.
>
> In an earlier project I also made a check on the main page
> that serialised it to memory on every request in development
> mode. It might be a good idea to do something like this but
> make it check that the cloned object is equal to the
> original.
>
> Yours is a nasty case as in that serialisation seems to fail
> (or rather work in a broken way) silently.
>
> For persistent objects (you said the parent class was a
> @MappedSuperclass right?) it often makes sense to make them
> inherit or implement a common base class / interface that
> implements / extends Serializable.
>
> Best wishes,
> Timo
>
> --
> Timo Rantalaiho
> Reaktor Innovations Oyhttp://www.ri.fi/ >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Today's installment of "well, duh." Was: Re: only 1 version of page in the cache at a time?

2007-11-27 Thread Timo Rantalaiho
On Tue, 27 Nov 2007, Evan Chooly wrote:
> So here's the skinny:  while my subclass was marked as serializable, the
> parent class was not.  So no state from the parent class got serialized nor,
> not so surprisingly, deserialized.  After adding that implements clause
> things miraculously started working.  So a big "you idiot" for me and a big
> thanks to igor for pointing me to the Objects.cloneObject() method to help
> write unit tests to highlight my otherwise obvious error.

In an earlier project I also made a check on the main page
that serialised it to memory on every request in development
mode. It might be a good idea to do something like this but
make it check that the cloned object is equal to the 
original.

Yours is a nasty case as in that serialisation seems to fail
(or rather work in a broken way) silently.

For persistent objects (you said the parent class was a
@MappedSuperclass right?) it often makes sense to make them
inherit or implement a common base class / interface that 
implements / extends Serializable.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations Oyhttp://www.ri.fi/ >

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



Today's installment of "well, duh." Was: Re: only 1 version of page in the cache at a time?

2007-11-27 Thread Evan Chooly
So here's the skinny:  while my subclass was marked as serializable, the
parent class was not.  So no state from the parent class got serialized nor,
not so surprisingly, deserialized.  After adding that implements clause
things miraculously started working.  So a big "you idiot" for me and a big
thanks to igor for pointing me to the Objects.cloneObject() method to help
write unit tests to highlight my otherwise obvious error.

On Nov 27, 2007 5:29 PM, Evan Chooly <[EMAIL PROTECTED]> wrote:

> Thanks for the tip, igor.  i wasn't sure how to get at the serialization
> code directly without going through all the page stuff as well.
> (DetachedReport)Objects.cloneObject(report) does indeed return an empty
> Report object so there's something not quite right there.  At least now I
> have a place i can focus on without having to worry about all the other
> wicket layers.  I'll let you know what I find out.
>
>
> On Nov 27, 2007 2:36 PM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>
> > run it through Objects.clone() and see what you get back
> >
> > -igor
> >
> >
> > On Nov 27, 2007 11:35 AM, Evan Chooly < [EMAIL PROTECTED]> wrote:
> > > Just a pojo.  (that's right!  i said it!  pojo!  pojo!  pojo!)  It
> > does have
> > > a baseclass annotated with @MappedSuperclass but that shouldn't cause
> > any
> > > problems.  The object is created by calling new and is never touched
> > by
> > > hibernate.
> > >
> > >
> > > On Nov 27, 2007 2:31 PM, Igor Vaynberg <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > > what is this report object?
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Nov 27, 2007 11:27 AM, Evan Chooly <[EMAIL PROTECTED]> wrote:
> > > > > Just about every field in my model object.  Though it would appear
> > that
> > > > the
> > > > > date object(s) is set to "now."
> > > > >
> > > > >
> > > > > On Nov 27, 2007 2:23 PM, Johan Compagner <[EMAIL PROTECTED] >
> > wrote:
> > > > >
> > > > > > But what field is then exactly null???
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Nov 27, 2007 7:05 PM, Evan Chooly < [EMAIL PROTECTED]>
> > wrote:
> > > > > >
> > > > > > > just something like:
> > > > > > >
> > > > > > > setModel(new CompoundPropertyModel(report));
> > > > > > >
> > > > > > > On Nov 27, 2007 1:04 PM, Igor Vaynberg <
> > [EMAIL PROTECTED]>
> > > > wrote:
> > > > > > >
> > > > > > > > ok, so the model is there, but the object inside it suddenly
> > is
> > > > null?
> > > > > > > > what kind of model is it?
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > > On Nov 27, 2007 9:56 AM, Evan Chooly <[EMAIL PROTECTED]>
> > wrote:
> > > > > > > > > No, they're "detached" versions which are basically clones
> > so
> > > > > > there's
> > > > > > > no
> > > > > > > > > hibernate proxies involved.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Nov 27, 2007 12:42 PM, Igor Vaynberg <
> > [EMAIL PROTECTED]
> > > > >
> > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > these objects are not by chance hibernate objects?
> > because if
> > > > you
> > > > > > > > > > serialize and then deserialize all the collections come
> > back
> > > > as
> > > > > > > empty
> > > > > > > > > > standard jdk collections instead of hibernate proxies
> > > > sometimes
> > > > > > > > > >
> > > > > > > > > > -igor
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > On Nov 27, 2007 8:49 AM, Evan Chooly <
> > [EMAIL PROTECTED]>
> > > > wrote:
> > > > > > > > > > > No transient fields.  Everything is serializable.
> >  We're
> > > > storing
> > > > > > > the
> > > > > > > > > > > complete objects in the model for a number of reasons.
> >  When
> > > > we
> > > > > > > come
> > > > > > > > > > back to
> > > > > > > > > > > the page we have some object but the state is gone.  I
> > think
> > > > > > it's
> > > > > > > > > > because
> > > > > > > > > > > we're redirecting back to the same page class/type so
> > the
> > > > old
> > > > > > one
> > > > > > > > gets
> > > > > > > > > > > dumped.  Probably what I'll have to do,then, is to
> > build
> > > > special
> > > > > > > > > > subclasses
> > > > > > > > > > > for the drilldown so that the page type changes on
> > each
> > > > step.
> > > > > > > >  Unless
> > > > > > > > > > > there's some way to increment the number of versions
> > per
> > > > > > > pagemap...
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > On Nov 27, 2007 11:39 AM, Johan Compagner <
> > > > [EMAIL PROTECTED]>
> > > > > > > > wrote:
> > > > > > > > > > >
> > > > > > > > > > > > Yes in wicket 1.3 there is only 1 active page per
> > pagemap
> > > > > > > > > > > >
> > > > > > > > > > > > But it shouldn't matter where the page comes from.
> > If it
> > > > is
> > > > > > > > serialized
> > > > > > > > > > > > from
> > > > > > > > > > > > disk
> > > > > > > > > > > > or serialized in the session somehow by the
> > container, You
> > > > > > still
> > > > > > > > > > should be
> > > > > > > > > > > > able
> > > > > > > > > > > > to fully construct al