Hi Alexandru, Wicket checker ends up invoking Object#equals in all objects
reachable by the checker.
It is up to hibernate to don't try to initialize your collection if it is
not the time. Ex.: PersistentBag#equals implementation, jus copy pasting the
its code comment:
/**
 * Bag does not respect the collection API and do an
 * JVM instance comparison to do the equals.
 * The semantic is broken not to have to initialize a
 * collection for a simple equals() operation.
 * @see java.lang.Object#equals(java.lang.Object)
 */

The problem is that not every AbstractPersistentCollection have the same
behavior, for instance PersistentSet#equals tries to initialize the
collection for its meta data.

Anyway, it is better to use an loadable detachable model as Igor suggested.

On Mon, Feb 14, 2011 at 2:23 PM, Alexandru Artimon <
aarti...@dgfoundation.org> wrote:

> Hello,
>
> I'm having some problems in porting our application to Wicket.
>
> Wicket Serializable Checker tries to see if all the fields in a hibernate
> bean are serializable, but some of the fields are collections that have lazy
> set to true. Now, at the moment it tries to check those collections the
> session is closed and thus a "failed to lazily initialize a collection"
> exception arises. If the session was open then this checker will probably
> initialize all the lazy collections recursive and will make the lazy setting
> useless.
>
> In order to avoid this problem I started setting the "lazy collection"
> fields to transient in the POJOs, which doesn't affect saving it with
> hibernate. But I realize we have a lot of collections with lazy true.
>
> Is there some elegant solution? Maybe like turning the Serializable Checker
> off?
>
> Thanks,
> Alexandru
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos

Reply via email to