how to pass component as parameters

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|

how to pass component as parameters

pepone.onrez
Hello i trying to create a menu componet in tapestry

my problem is that i don know how to pass a component to parameter

<div jwcid="@Menu" name="topMenu" style="topmenu" itemSelected="Inicio">
    <div
jwcid="@ItemMenu" name="Inicio" icon="/onrez/img/logout.png"
menu="ognl:topMenu">
</div>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to pass component as parameters

pepone.onrez
sorry for split this post

ItemMenu must receive a parameter of type Menu in order to call a
method of menu whe item is selected

any body can say me if is posible do it

Thanks


On 5/17/05, pepone pepone <[hidden email]> wrote:

> Hello i trying to create a menu componet in tapestry
>
> my problem is that i don know how to pass a component to parameter
>
> <div jwcid="@Menu" name="topMenu" style="topmenu" itemSelected="Inicio">
>         <div
> jwcid="@ItemMenu" name="Inicio" icon="/onrez/img/logout.png"
> menu="ognl:topMenu">
> </div>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Hibernate + Spring: LazyInitializationException

Juan Esteban Maya
Hi..
I have been trying to use Tapestry with Spring + Hibernate 3.
I have follow the wiki help about this issue, but i keep getting a
LazyInitializationException everytime i load a lazy relation. Is there
anything more needed to get hibernate lazy loading working?

Thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to pass component as parameters

Pablo Ruggia
In reply to this post by pepone.onrez
I don't know if you knew it, but you can use Krysalis Menu, a set of
tapestry component that renders a very configurable javascript menu.

On 5/16/05, pepone pepone <[hidden email]> wrote:

> sorry for split this post
>
> ItemMenu must receive a parameter of type Menu in order to call a
> method of menu whe item is selected
>
> any body can say me if is posible do it
>
> Thanks
>
>
> On 5/17/05, pepone pepone <[hidden email]> wrote:
> > Hello i trying to create a menu componet in tapestry
> >
> > my problem is that i don know how to pass a component to parameter
> >
> > <div jwcid="@Menu" name="topMenu" style="topmenu" itemSelected="Inicio">
> >         <div
> > jwcid="@ItemMenu" name="Inicio" icon="/onrez/img/logout.png"
> > menu="ognl:topMenu">
> > </div>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to pass component as parameters

Joshua Long
Passing a component works like this :

 

<span jwcid = "foo@Bar"> My bar </span>

<a href="#" jwcid="@Bar2" bar = "ognl:components.foo">
    my bar2 component,w hich needs to talk with a Bar component </a>



Like with the Block/ RenderBlock combo:

<div jwcid="myblock@Block">
<p>  This is a test that will only be rendered if getFeelingLucky()
returns true. </p> </div>

<span jwcid= "@Conditional" condition = "ognl:feelingLucky">
<span jwcid="@RenderBlock" block = "ognl:components.myblock" />
</span>




HTH,

Josh





[hidden email] Tue, 2005-05-17 at 12:48 -0300, Pablo
Ruggia wrote:

> I don't know if you knew it, but you can use Krysalis Menu, a set of
> tapestry component that renders a very configurable javascript menu.
>
> On 5/16/05, pepone pepone <[hidden email]> wrote:
> > sorry for split this post
> >
> > ItemMenu must receive a parameter of type Menu in order to call a
> > method of menu whe item is selected
> >
> > any body can say me if is posible do it
> >
> > Thanks
> >
> >
> > On 5/17/05, pepone pepone <[hidden email]> wrote:
> > > Hello i trying to create a menu componet in tapestry
> > >
> > > my problem is that i don know how to pass a component to parameter
> > >
> > > <div jwcid="@Menu" name="topMenu" style="topmenu" itemSelected="Inicio">
> > >         <div
> > > jwcid="@ItemMenu" name="Inicio" icon="/onrez/img/logout.png"
> > > menu="ognl:topMenu">
> > > </div>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
--
Joshua Long <[hidden email]>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Pablo Ruggia
In reply to this post by Juan Esteban Maya
I've not found any reasonable, easy and transparent solution to this.
So I turn off lazy initializations and try to map as less collections as I can.

But if you want to investigate, here is a link to a solution using
Tapestry + Spring + Hibernate  (I really don't like it):

http://wiki.apache.org/jakarta-tapestry/FrequentlyAskedQuestions/SpringHibernate

 

On 5/17/05, Juan Esteban Maya <[hidden email]> wrote:

> Hi..
> I have been trying to use Tapestry with Spring + Hibernate 3.
> I have follow the wiki help about this issue, but i keep getting a
> LazyInitializationException everytime i load a lazy relation. Is there
> anything more needed to get hibernate lazy loading working?
>
> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Nathan Kopp
In reply to this post by Juan Esteban Maya
This is a tough one.  IMHO, it is a weakness of Hibernate.

Anyway, "fixed" the problem by modifying Hibernate.  (Yes, I have customized
and misused both Tapestry and Hibernate to serve my own purposes... ah, the
beauty of open source!)  I made modifications to
AbstractPersistentCollection and AbstractLazyInitializer so that they would
open a new session (then close it later) instead of throwing an exception.
Right now my custom versions contain some application-specific code to
access my SessionFactory (which is stored in a singleton object), since I
haven't yet come up with a cleaner solution.

-Nathan


----- Original Message -----
From: "Juan Esteban Maya" <[hidden email]>
To: "Tapestry users" <[hidden email]>; "pepone pepone"
<[hidden email]>
Sent: Tuesday, May 17, 2005 7:00 AM
Subject: Hibernate + Spring: LazyInitializationException


Hi..
I have been trying to use Tapestry with Spring + Hibernate 3.
I have follow the wiki help about this issue, but i keep getting a
LazyInitializationException everytime i load a lazy relation. Is there
anything more needed to get hibernate lazy loading working?

Thanks in advance


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Didier LAFFORGUE
In reply to this post by Juan Esteban Maya

I think that the LazyInitializationException occurs when you try to access a property of your object outside the hibernate session.
In fact, imagine you have 2 mapped objects: employee and company => in this example, an employee has only one company.
First of all, you load the employee with the id 1. In the lazy mode, the associated company is not loaded.
If you do not close the current hibernate session, if you do a "employee.getCompany()", hibernate will use the session to load the company object.
BUT if you close the session and after if you do the "employee.getCompany()" statement, you'll get the LazyInitializationException.
The solution would be to keep the hibernate session in the session scope but I find this solution very dirty. Another solution is to create the session when the page begins to render and to close it when the rendering is finished (not tested so....).
I hope that my explanation was rather clear ;-)))

  Did


----- Original Message -----
From: "Juan Esteban Maya" <[hidden email]>
To: "Tapestry users" <[hidden email]>; "pepone pepone" <[hidden email]>
Sent: Tuesday, May 17, 2005 1:00 PM
Subject: Hibernate + Spring: LazyInitializationException


> Hi..
> I have been trying to use Tapestry with Spring + Hibernate 3.
> I have follow the wiki help about this issue, but i keep getting a
> LazyInitializationException everytime i load a lazy relation. Is there
> anything more needed to get hibernate lazy loading working?
>
> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Markus Eberle
Zitat von Didier LAFFORGUE <[hidden email]>:

>
> I think that the LazyInitializationException occurs when you try to access a
> property of your object outside the hibernate session.
> In fact, imagine you have 2 mapped objects: employee and company => in this
> example, an employee has only one company.
> First of all, you load the employee with the id 1. In the lazy mode, the
> associated company is not loaded.
> If you do not close the current hibernate session, if you do a
> "employee.getCompany()", hibernate will use the session to load the company
> object.
> BUT if you close the session and after if you do the "employee.getCompany()"
> statement, you'll get the LazyInitializationException.
> The solution would be to keep the hibernate session in the session scope but
> I find this solution very dirty.

This _is_ very dirty.

> Another solution is to create the session
> when the page begins to render and to close it when the rendering is finished
> (not tested so....).

In most cases you can use the OpenSessionInViewFilter (i think this is the name)
from spring.
The problem is, that you get a new Hibernate-Session, so you have to re-attach
the objects if you re-use them.

Cheers,
    Markus


> ----- Original Message -----
> From: "Juan Esteban Maya" <[hidden email]>
> To: "Tapestry users" <[hidden email]>; "pepone pepone"
> <[hidden email]>
> Sent: Tuesday, May 17, 2005 1:00 PM
> Subject: Hibernate + Spring: LazyInitializationException
>
>
> > Hi..
> > I have been trying to use Tapestry with Spring + Hibernate 3.
> > I have follow the wiki help about this issue, but i keep getting a
> > LazyInitializationException everytime i load a lazy relation. Is there
> > anything more needed to get hibernate lazy loading working?
> >
> > Thanks in advance
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> This message contains information that may be privileged or confidential and
> is the property of the Capgemini Group. It is intended only for the person to
> whom it is addressed. If you are not the intended recipient,  you are not
> authorized to read, print, retain, copy, disseminate,  distribute, or use
> this message or any part thereof. If you receive this  message in error,
> please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Didier LAFFORGUE

Completely, I agree with you. Moreover, in my example, when you create a new session, you have to reattach the main object (employee) and its dependencies (company). So, if you want to update the "employee", you should do:

---------------------------------------------------
Session session = HibernateFactory.getCurrentSession();

Employee employee = session.load(getEmployeeId());
Company company = session.load(getCompanyId());
employee.setCompany(company);
session.save(employee); // I'm not sure of the syntax.
---------------------------------------------------

What is your opinion about it Markus ?


    Did

----- Original Message -----
From: "Markus Eberle" <[hidden email]>
To: "Tapestry users" <[hidden email]>; "Didier LAFFORGUE" <[hidden email]>
Cc: "Tapestry users" <[hidden email]>; "Juan Esteban Maya" <[hidden email]>
Sent: Wednesday, May 18, 2005 2:05 PM
Subject: Re: Hibernate + Spring: LazyInitializationException


> Zitat von Didier LAFFORGUE <[hidden email]>:
>
> >
> > I think that the LazyInitializationException occurs when you try to access a
> > property of your object outside the hibernate session.
> > In fact, imagine you have 2 mapped objects: employee and company => in this
> > example, an employee has only one company.
> > First of all, you load the employee with the id 1. In the lazy mode, the
> > associated company is not loaded.
> > If you do not close the current hibernate session, if you do a
> > "employee.getCompany()", hibernate will use the session to load the company
> > object.
> > BUT if you close the session and after if you do the "employee.getCompany()"
> > statement, you'll get the LazyInitializationException.
> > The solution would be to keep the hibernate session in the session scope but
> > I find this solution very dirty.
>
> This _is_ very dirty.
>
> > Another solution is to create the session
> > when the page begins to render and to close it when the rendering is finished
> > (not tested so....).
>
> In most cases you can use the OpenSessionInViewFilter (i think this is the name)
> from spring.
> The problem is, that you get a new Hibernate-Session, so you have to re-attach
> the objects if you re-use them.
>
> Cheers,
>     Markus
>
>
> > ----- Original Message -----
> > From: "Juan Esteban Maya" <[hidden email]>
> > To: "Tapestry users" <[hidden email]>; "pepone pepone"
> > <[hidden email]>
> > Sent: Tuesday, May 17, 2005 1:00 PM
> > Subject: Hibernate + Spring: LazyInitializationException
> >
> >
> > > Hi..
> > > I have been trying to use Tapestry with Spring + Hibernate 3.
> > > I have follow the wiki help about this issue, but i keep getting a
> > > LazyInitializationException everytime i load a lazy relation. Is there
> > > anything more needed to get hibernate lazy loading working?
> > >
> > > Thanks in advance
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> > This message contains information that may be privileged or confidential and
> > is the property of the Capgemini Group. It is intended only for the person to
> > whom it is addressed. If you are not the intended recipient,  you are not
> > authorized to read, print, retain, copy, disseminate,  distribute, or use
> > this message or any part thereof. If you receive this  message in error,
> > please notify the sender immediately and delete all  copies of this message.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Hibernate + Spring: LazyInitializationException

Joel Trunick
In reply to this post by Juan Esteban Maya

Or you could fix it by using another open source project, Cayenne.
Cayenne objects know their context.

J

-----Original Message-----
From: Nathan Kopp [mailto:[hidden email]]
Sent: Tuesday, May 17, 2005 10:24 PM
To: Tapestry users
Subject: Re: Hibernate + Spring: LazyInitializationException

This is a tough one.  IMHO, it is a weakness of Hibernate.

Anyway, "fixed" the problem by modifying Hibernate.  (Yes, I have
customized
and misused both Tapestry and Hibernate to serve my own purposes... ah,
the
beauty of open source!)  I made modifications to
AbstractPersistentCollection and AbstractLazyInitializer so that they
would
open a new session (then close it later) instead of throwing an
exception.
Right now my custom versions contain some application-specific code to
access my SessionFactory (which is stored in a singleton object), since
I
haven't yet come up with a cleaner solution.

-Nathan


----- Original Message -----
From: "Juan Esteban Maya" <[hidden email]>
To: "Tapestry users" <[hidden email]>; "pepone pepone"
<[hidden email]>
Sent: Tuesday, May 17, 2005 7:00 AM
Subject: Hibernate + Spring: LazyInitializationException


Hi..
I have been trying to use Tapestry with Spring + Hibernate 3.
I have follow the wiki help about this issue, but i keep getting a
LazyInitializationException everytime i load a lazy relation. Is there
anything more needed to get hibernate lazy loading working?

Thanks in advance


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Pablo Ruggia
The problem with reattachment is that I have to do it, it's not automatically.
I don't understand why Hibernate can't simply open a new session when
the one wich has is closed.
I supose I'll have to patch it in my Hibernate's source, and wait
until it becames a new feature in future releases of Hibernate. Lazy
initialization is an important key in persistence performance.

On 5/18/05, Joel Trunick <[hidden email]> wrote:

>
> Or you could fix it by using another open source project, Cayenne.
> Cayenne objects know their context.
>
> J
>
> -----Original Message-----
> From: Nathan Kopp [mailto:[hidden email]]
> Sent: Tuesday, May 17, 2005 10:24 PM
> To: Tapestry users
> Subject: Re: Hibernate + Spring: LazyInitializationException
>
> This is a tough one.  IMHO, it is a weakness of Hibernate.
>
> Anyway, "fixed" the problem by modifying Hibernate.  (Yes, I have
> customized
> and misused both Tapestry and Hibernate to serve my own purposes... ah,
> the
> beauty of open source!)  I made modifications to
> AbstractPersistentCollection and AbstractLazyInitializer so that they
> would
> open a new session (then close it later) instead of throwing an
> exception.
> Right now my custom versions contain some application-specific code to
> access my SessionFactory (which is stored in a singleton object), since
> I
> haven't yet come up with a cleaner solution.
>
> -Nathan
>
> ----- Original Message -----
> From: "Juan Esteban Maya" <[hidden email]>
> To: "Tapestry users" <[hidden email]>; "pepone pepone"
> <[hidden email]>
> Sent: Tuesday, May 17, 2005 7:00 AM
> Subject: Hibernate + Spring: LazyInitializationException
>
> Hi..
> I have been trying to use Tapestry with Spring + Hibernate 3.
> I have follow the wiki help about this issue, but i keep getting a
> LazyInitializationException everytime i load a lazy relation. Is there
> anything more needed to get hibernate lazy loading working?
>
> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Chris Nelson
In reply to this post by Juan Esteban Maya
I've attempted this.  It's not really as easy as it
sounds :(  I keep thinking of trying to do it as an
AspectJ aspect, but haven't got it together to do it
(yet).

--- Pablo Ruggia <[hidden email]> wrote:

> The problem with reattachment is that I have to do
> it, it's not automatically.
> I don't understand why Hibernate can't simply open a
> new session when
> the one wich has is closed.
> I supose I'll have to patch it in my Hibernate's
> source, and wait
> until it becames a new feature in future releases of
> Hibernate. Lazy
> initialization is an important key in persistence
> performance.
>
> On 5/18/05, Joel Trunick
> <[hidden email]> wrote:
> >
> > Or you could fix it by using another open source
> project, Cayenne.
> > Cayenne objects know their context.
> >
> > J
> >
> > -----Original Message-----
> > From: Nathan Kopp [mailto:[hidden email]]
> > Sent: Tuesday, May 17, 2005 10:24 PM
> > To: Tapestry users
> > Subject: Re: Hibernate + Spring:
> LazyInitializationException
> >
> > This is a tough one.  IMHO, it is a weakness of
> Hibernate.
> >
> > Anyway, "fixed" the problem by modifying
> Hibernate.  (Yes, I have
> > customized
> > and misused both Tapestry and Hibernate to serve
> my own purposes... ah,
> > the
> > beauty of open source!)  I made modifications to
> > AbstractPersistentCollection and
> AbstractLazyInitializer so that they
> > would
> > open a new session (then close it later) instead
> of throwing an
> > exception.
> > Right now my custom versions contain some
> application-specific code to
> > access my SessionFactory (which is stored in a
> singleton object), since
> > I
> > haven't yet come up with a cleaner solution.
> >
> > -Nathan
> >
> > ----- Original Message -----
> > From: "Juan Esteban Maya" <[hidden email]>
> > To: "Tapestry users"
> <[hidden email]>; "pepone pepone"
> > <[hidden email]>
> > Sent: Tuesday, May 17, 2005 7:00 AM
> > Subject: Hibernate + Spring:
> LazyInitializationException
> >
> > Hi..
> > I have been trying to use Tapestry with Spring +
> Hibernate 3.
> > I have follow the wiki help about this issue, but
> i keep getting a
> > LazyInitializationException everytime i load a
> lazy relation. Is there
> > anything more needed to get hibernate lazy loading
> working?
> >
> > Thanks in advance
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [hidden email]
> > For additional commands, e-mail:
> [hidden email]
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [hidden email]
> > For additional commands, e-mail:
> [hidden email]
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [hidden email]
> For additional commands, e-mail:
> [hidden email]
>
>


               
__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

phillip rhodes
In reply to this post by Juan Esteban Maya
Another solution....

I have worked around this problem by using
Hibernate.initialize(myobject.getMyCollection())

You need to look at your application use cases and
load the things upfront that you will be needing.


--- Chris Nelson <[hidden email]> wrote:

> I've attempted this.  It's not really as easy as it
> sounds :(  I keep thinking of trying to do it as an
> AspectJ aspect, but haven't got it together to do it
> (yet).
>
> --- Pablo Ruggia <[hidden email]> wrote:
> > The problem with reattachment is that I have to do
> > it, it's not automatically.
> > I don't understand why Hibernate can't simply open
> a
> > new session when
> > the one wich has is closed.
> > I supose I'll have to patch it in my Hibernate's
> > source, and wait
> > until it becames a new feature in future releases
> of
> > Hibernate. Lazy
> > initialization is an important key in persistence
> > performance.
> >
> > On 5/18/05, Joel Trunick
> > <[hidden email]> wrote:
> > >
> > > Or you could fix it by using another open source
> > project, Cayenne.
> > > Cayenne objects know their context.
> > >
> > > J
> > >
> > > -----Original Message-----
> > > From: Nathan Kopp [mailto:[hidden email]]
> > > Sent: Tuesday, May 17, 2005 10:24 PM
> > > To: Tapestry users
> > > Subject: Re: Hibernate + Spring:
> > LazyInitializationException
> > >
> > > This is a tough one.  IMHO, it is a weakness of
> > Hibernate.
> > >
> > > Anyway, "fixed" the problem by modifying
> > Hibernate.  (Yes, I have
> > > customized
> > > and misused both Tapestry and Hibernate to serve
> > my own purposes... ah,
> > > the
> > > beauty of open source!)  I made modifications to
> > > AbstractPersistentCollection and
> > AbstractLazyInitializer so that they
> > > would
> > > open a new session (then close it later) instead
> > of throwing an
> > > exception.
> > > Right now my custom versions contain some
> > application-specific code to
> > > access my SessionFactory (which is stored in a
> > singleton object), since
> > > I
> > > haven't yet come up with a cleaner solution.
> > >
> > > -Nathan
> > >
> > > ----- Original Message -----
> > > From: "Juan Esteban Maya" <[hidden email]>
> > > To: "Tapestry users"
> > <[hidden email]>; "pepone
> pepone"
> > > <[hidden email]>
> > > Sent: Tuesday, May 17, 2005 7:00 AM
> > > Subject: Hibernate + Spring:
> > LazyInitializationException
> > >
> > > Hi..
> > > I have been trying to use Tapestry with Spring +
> > Hibernate 3.
> > > I have follow the wiki help about this issue,
> but
> > i keep getting a
> > > LazyInitializationException everytime i load a
> > lazy relation. Is there
> > > anything more needed to get hibernate lazy
> loading
> > working?
> > >
> > > Thanks in advance
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [hidden email]
> > > For additional commands, e-mail:
> > [hidden email]
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [hidden email]
> > > For additional commands, e-mail:
> > [hidden email]
> > >
> > >
> >
> >
>
---------------------------------------------------------------------

> > To unsubscribe, e-mail:
> > [hidden email]
> > For additional commands, e-mail:
> > [hidden email]
> >
> >
>
>
>
> __________________________________
> Yahoo! Mail Mobile
> Take Yahoo! Mail with you! Check email on your
> mobile phone.
> http://mobile.yahoo.com/learn/mail 
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [hidden email]
> For additional commands, e-mail:
> [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Pablo Ruggia
> I have worked around this problem by using
> Hibernate.initialize(myobject.getMyCollection())
>
> You need to look at your application use cases and
> load the things upfront that you will be needing.

It's still too manual, but using this way combined with some aspects,
does not sound crazy. I'll be testing this solution on a few days,
i'll told you how it goes.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Marcus.Schulte
In reply to this post by Juan Esteban Maya
I'm using the long session pattern put forward in HIA by Bauer&King. This
works very well - no LazyInitializationException nor
NonUniqueObjectExceptions when re-attaching objects. In fact, no
re-attaching at all.
The recipe is:
  1. ServletFilter to manage mapping of Http-Sessions to Hibernate-Sessions
and putting the latter in a convenient ThreadLocal
  2. An IActionListener-Wrapper to commit/rollback as desired
  3. Not forgetting to close your Session and throw away your persistent
objects at an appropriate point (typically, this is "user choses new
working-set" or somethin like that)
Only "drawback" - the pattern is not supported by any IoC-Containers out of
the box - at least by none I know of.
If anybody is interested I could post some code ...

Marcus

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Pablo Ruggia
And what happens if you need to access a Collection in a second
request from user. How it works if you do not reattach the object ?

On 5/19/05, Schulte Marcus <[hidden email]> wrote:

> I'm using the long session pattern put forward in HIA by Bauer&King. This
> works very well - no LazyInitializationException nor
> NonUniqueObjectExceptions when re-attaching objects. In fact, no
> re-attaching at all.
> The recipe is:
>   1. ServletFilter to manage mapping of Http-Sessions to Hibernate-Sessions
> and putting the latter in a convenient ThreadLocal
>   2. An IActionListener-Wrapper to commit/rollback as desired
>   3. Not forgetting to close your Session and throw away your persistent
> objects at an appropriate point (typically, this is "user choses new
> working-set" or somethin like that)
> Only "drawback" - the pattern is not supported by any IoC-Containers out of
> the box - at least by none I know of.
> If anybody is interested I could post some code ...
>
> Marcus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Pablo Ruggia
Mmm, so you keep using the same session for more than one request form
the same user ?

On 5/19/05, Pablo Ruggia <[hidden email]> wrote:

> And what happens if you need to access a Collection in a second
> request from user. How it works if you do not reattach the object ?
>
> On 5/19/05, Schulte Marcus <[hidden email]> wrote:
> > I'm using the long session pattern put forward in HIA by Bauer&King. This
> > works very well - no LazyInitializationException nor
> > NonUniqueObjectExceptions when re-attaching objects. In fact, no
> > re-attaching at all.
> > The recipe is:
> >   1. ServletFilter to manage mapping of Http-Sessions to Hibernate-Sessions
> > and putting the latter in a convenient ThreadLocal
> >   2. An IActionListener-Wrapper to commit/rollback as desired
> >   3. Not forgetting to close your Session and throw away your persistent
> > objects at an appropriate point (typically, this is "user choses new
> > working-set" or somethin like that)
> > Only "drawback" - the pattern is not supported by any IoC-Containers out of
> > the box - at least by none I know of.
> > If anybody is interested I could post some code ...
> >
> > Marcus
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hibernate + Spring: LazyInitializationException

Jacob von Eyben
In reply to this post by Pablo Ruggia
As he descripes it, there is no reattachment needed at all.
The session is keept in the HTTPSession throughout the
application-transaction, so the next request from the user is just working
on the domain objects already associated with the ongoing hibernate
session.

/Jacob

> And what happens if you need to access a Collection in a second
> request from user. How it works if you do not reattach the object ?
>
> On 5/19/05, Schulte Marcus <[hidden email]> wrote:
>> I'm using the long session pattern put forward in HIA by Bauer&King.
>> This
>> works very well - no LazyInitializationException nor
>> NonUniqueObjectExceptions when re-attaching objects. In fact, no
>> re-attaching at all.
>> The recipe is:
>>   1. ServletFilter to manage mapping of Http-Sessions to
>> Hibernate-Sessions
>> and putting the latter in a convenient ThreadLocal
>>   2. An IActionListener-Wrapper to commit/rollback as desired
>>   3. Not forgetting to close your Session and throw away your persistent
>> objects at an appropriate point (typically, this is "user choses new
>> working-set" or somethin like that)
>> Only "drawback" - the pattern is not supported by any IoC-Containers out
>> of
>> the box - at least by none I know of.
>> If anybody is interested I could post some code ...
>>
>> Marcus
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Hibernate + Spring: LazyInitializationException

Marcus.Schulte
In reply to this post by Juan Esteban Maya
I never detach the object from the session - so the sequence is like this
(starting with a fresh session):

   1. Request: -make new Hibernate session
               -get all X from Database,
               -render list of X
               -disconnect hib-session from DB and store it in http-Session
(X's are NOT detached here).
   
    2. Request - lookup user's http session, get his hib-session
               - reconnect hib-session to Datasource
               - load collection X.allMyYs for some X lazily (no Problem,
the X's are still attached)
                   - render allMyYs
                   - as 1. Request

For me, I *really* started to enjoy Hibernate only after I switching to the
long session pattern.

Marcus


> -----Original Message-----
> From: Pablo Ruggia [mailto:[hidden email]]
> Sent: Thursday, May 19, 2005 2:25 PM
> To: Tapestry users
> Subject: Re: Hibernate + Spring: LazyInitializationException
>
>
> And what happens if you need to access a Collection in a second
> request from user. How it works if you do not reattach the object ?
>
> On 5/19/05, Schulte Marcus <[hidden email]> wrote:
> > I'm using the long session pattern put forward in HIA by
> Bauer&King. This
> > works very well - no LazyInitializationException nor
> > NonUniqueObjectExceptions when re-attaching objects. In fact, no
> > re-attaching at all.
> > The recipe is:
> >   1. ServletFilter to manage mapping of Http-Sessions to
> Hibernate-Sessions
> > and putting the latter in a convenient ThreadLocal
> >   2. An IActionListener-Wrapper to commit/rollback as desired
> >   3. Not forgetting to close your Session and throw away
> your persistent
> > objects at an appropriate point (typically, this is "user choses new
> > working-set" or somethin like that)
> > Only "drawback" - the pattern is not supported by any
> IoC-Containers out of
> > the box - at least by none I know of.
> > If anybody is interested I could post some code ...
> >
> > Marcus
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail:
> [hidden email]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12