You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jan Vissers <Ja...@cumquat.nl> on 2007/08/28 23:17:38 UTC

T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and PropertySelectionModel stuff

Hi,

I'm witnessing some 'interesting' behavior, using lazily loaded
collections (Hibernate) combined with PropertySelectionModel stuff. Before
getting into too much detail - using my JUnit tests I can prove that
traversing the (nested) objectgraph actually has the information (albeit
via CGLIB proxies). When using this in my T4.1.2 page however, I see that
the correct poplist value doesn't get selected. In a read only version of
the page on the other hand - where the poplist is dynamically replaced by
a readonly display item - the information is shown.

Is there something that I should be aware of in using T4/Hib3 regarding
the selectionmodel component?

-J.

BTW: I'm using OpenSessionInView provided by Spring.


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


Re: T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and PropertySelectionModel stuff

Posted by Kalle Korhonen <ka...@gmail.com>.
Not sure about the best solution, but we use:
    public static Class checkForCGLIB(Class type)
    {
        if (type.getName().contains("CGLIB"))
        {
            return type.getSuperclass();
        } else return type;
    }

Kalle

On 8/29/07, Jan Vissers <Ja...@cumquat.nl> wrote:
>
> Problem indeed has to do with the 'equality' check that is performed...
> In there a class check like    if( obj instanceof MyClass ) is done, but
> obj is a CGLIB enhanced instance, which yields to an unequal class.
>
> What is the best solution to solve this?
> -J.
>
> Marcus Schulte wrote:
> > One thing to be aware of is that the same db-row, in two different
> > Hibernate-Session, corresponds to two different objects. So with
> > session-per-request, if your PSModel is loaded in one request, and
> > your value-parameter-object in another. If you don't override
> > Object.equals appropriately, Tapestry cannot know which list member to
> > show for a given value.
> >
> > 2007/8/28, Jan Vissers <Jan.Vissers@cumquat.nl
> > <ma...@cumquat.nl>>:
> >
> >     Hi,
> >
> >     I'm witnessing some 'interesting' behavior, using lazily loaded
> >     collections (Hibernate) combined with PropertySelectionModel
> >     stuff. Before
> >     getting into too much detail - using my JUnit tests I can prove that
> >     traversing the (nested) objectgraph actually has the information
> >     (albeit
> >     via CGLIB proxies). When using this in my T4.1.2 page however, I
> >     see that
> >     the correct poplist value doesn't get selected. In a read only
> >     version of
> >     the page on the other hand - where the poplist is dynamically
> >     replaced by
> >     a readonly display item - the information is shown.
> >
> >     Is there something that I should be aware of in using T4/Hib3
> >     regarding
> >     the selectionmodel component?
> >
> >     -J.
> >
> >     BTW: I'm using OpenSessionInView provided by Spring.
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >     <ma...@tapestry.apache.org>
> >     For additional commands, e-mail: users-help@tapestry.apache.org
> >     <ma...@tapestry.apache.org>
> >
> >
> >
> >
> > --
> > Marcus Schulte
> > http://marcus-schulte.blogspot.com <http://marcus-schulte.blogspot.com>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and PropertySelectionModel stuff

Posted by Jonathan Barker <jo...@gmail.com>.

I also experienced some grief (4.0.x) with PropertySelectionModel when using
Hibernate.  The behavior also changed between the PropertySelection
component and the Palette component because they use(d) different techniques
to find the matching item.

A good equality test and the tacos BeanPropertySelectionModel cleared up my
problems.

JB


> -----Original Message-----
> From: Jan Vissers [mailto:Jan.Vissers@cumquat.nl]
> Sent: Wednesday, August 29, 2007 5:54 AM
> To: Marcus Schulte
> Cc: Tapestry users
> Subject: Re: T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and
> PropertySelectionModel stuff
> 
> Problem indeed has to do with the 'equality' check that is performed...
> In there a class check like    if( obj instanceof MyClass ) is done, but
> obj is a CGLIB enhanced instance, which yields to an unequal class.
> 
> What is the best solution to solve this?
> -J.
> 
> Marcus Schulte wrote:
> > One thing to be aware of is that the same db-row, in two different
> > Hibernate-Session, corresponds to two different objects. So with
> > session-per-request, if your PSModel is loaded in one request, and
> > your value-parameter-object in another. If you don't override
> > Object.equals appropriately, Tapestry cannot know which list member to
> > show for a given value.
> >
> > 2007/8/28, Jan Vissers <Jan.Vissers@cumquat.nl
> > <ma...@cumquat.nl>>:
> >
> >     Hi,
> >
> >     I'm witnessing some 'interesting' behavior, using lazily loaded
> >     collections (Hibernate) combined with PropertySelectionModel
> >     stuff. Before
> >     getting into too much detail - using my JUnit tests I can prove that
> >     traversing the (nested) objectgraph actually has the information
> >     (albeit
> >     via CGLIB proxies). When using this in my T4.1.2 page however, I
> >     see that
> >     the correct poplist value doesn't get selected. In a read only
> >     version of
> >     the page on the other hand - where the poplist is dynamically
> >     replaced by
> >     a readonly display item - the information is shown.
> >
> >     Is there something that I should be aware of in using T4/Hib3
> >     regarding
> >     the selectionmodel component?
> >
> >     -J.
> >
> >     BTW: I'm using OpenSessionInView provided by Spring.
> >
> >
> >     --------------------------------------------------------------------
> -
> >     To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >     <ma...@tapestry.apache.org>
> >     For additional commands, e-mail: users-help@tapestry.apache.org
> >     <ma...@tapestry.apache.org>
> >
> >
> >
> >
> > --
> > Marcus Schulte
> > http://marcus-schulte.blogspot.com <http://marcus-schulte.blogspot.com>
> 
> 
> ---------------------------------------------------------------------
> 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: T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and PropertySelectionModel stuff

Posted by Jan Vissers <Ja...@cumquat.nl>.
Problem indeed has to do with the 'equality' check that is performed...
In there a class check like    if( obj instanceof MyClass ) is done, but 
obj is a CGLIB enhanced instance, which yields to an unequal class.

What is the best solution to solve this?
-J.

Marcus Schulte wrote:
> One thing to be aware of is that the same db-row, in two different 
> Hibernate-Session, corresponds to two different objects. So with 
> session-per-request, if your PSModel is loaded in one request, and 
> your value-parameter-object in another. If you don't override 
> Object.equals appropriately, Tapestry cannot know which list member to 
> show for a given value.
>
> 2007/8/28, Jan Vissers <Jan.Vissers@cumquat.nl 
> <ma...@cumquat.nl>>:
>
>     Hi,
>
>     I'm witnessing some 'interesting' behavior, using lazily loaded
>     collections (Hibernate) combined with PropertySelectionModel
>     stuff. Before
>     getting into too much detail - using my JUnit tests I can prove that
>     traversing the (nested) objectgraph actually has the information
>     (albeit
>     via CGLIB proxies). When using this in my T4.1.2 page however, I
>     see that
>     the correct poplist value doesn't get selected. In a read only
>     version of
>     the page on the other hand - where the poplist is dynamically
>     replaced by
>     a readonly display item - the information is shown.
>
>     Is there something that I should be aware of in using T4/Hib3
>     regarding
>     the selectionmodel component?
>
>     -J.
>
>     BTW: I'm using OpenSessionInView provided by Spring.
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>     <ma...@tapestry.apache.org>
>     For additional commands, e-mail: users-help@tapestry.apache.org
>     <ma...@tapestry.apache.org>
>
>
>
>
> -- 
> Marcus Schulte
> http://marcus-schulte.blogspot.com <http://marcus-schulte.blogspot.com> 


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


Re: T4.1.2 / Spring 2.0.6 / Hib3 Lazy loading and PropertySelectionModel stuff

Posted by Marcus Schulte <et...@googlemail.com>.
One thing to be aware of is that the same db-row, in two different
Hibernate-Session, corresponds to two different objects. So with
session-per-request, if your PSModel is loaded in one request, and your
value-parameter-object in another. If you don't override
Object.equalsappropriately, Tapestry cannot know which list member to
show for a given
value.

2007/8/28, Jan Vissers <Ja...@cumquat.nl>:
>
> Hi,
>
> I'm witnessing some 'interesting' behavior, using lazily loaded
> collections (Hibernate) combined with PropertySelectionModel stuff. Before
> getting into too much detail - using my JUnit tests I can prove that
> traversing the (nested) objectgraph actually has the information (albeit
> via CGLIB proxies). When using this in my T4.1.2 page however, I see that
> the correct poplist value doesn't get selected. In a read only version of
> the page on the other hand - where the poplist is dynamically replaced by
> a readonly display item - the information is shown.
>
> Is there something that I should be aware of in using T4/Hib3 regarding
> the selectionmodel component?
>
> -J.
>
> BTW: I'm using OpenSessionInView provided by Spring.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Marcus Schulte
http://marcus-schulte.blogspot.com