LazyInitializationException for ASO?

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

LazyInitializationException for ASO?

zack.manning
Hi All,

I have a very simple layout component where I look for two ASOs and display text based on them.  Component snip: http://pastebin.com/m69540e56.  Tml snip: http://pastebin.com/m4435806f.  I am getting this exception http://pastebin.com/m42ec222a.  I dont have any hibernate session injected and I am not calling any getters of objects that would throw a lazy init exception.  This happens even right after I restart jetty so both ASOs should be null right?  When I return null for getSurvey() the exception goes away.  Any ideas?

Thanks in advance,
Zack
Reply | Threaded
Open this post in threaded view
|

Re: LazyInitializationException for ASO?

Marcus Veloso
Hi Zack,

Maybe the problem is related to Survey.java, can you post the code?

Marcus
Reply | Threaded
Open this post in threaded view
|

Re: LazyInitializationException for ASO?

zack.manning
Its a pretty simple hibernate entity: http://pastebin.com/m6c765ff4

Would it matter that Project is a property of Survey?

Thanks for the quick reply!

Zack
Marcus wrote
Hi Zack,

Maybe the problem is related to Survey.java, can you post the code?

Marcus
Reply | Threaded
Open this post in threaded view
|

RE: LazyInitializationException for ASO?

Jonathan Barker
In reply to this post by zack.manning

Are there any places where you use the @ApplicationState annotation for
Survey or Project without create=false?

What happens if you test on "surveyExists" which would be the way before the
create=false option was introduced?




> -----Original Message-----
> From: zack.manning [mailto:[hidden email]]
> Sent: Monday, July 07, 2008 14:01
> To: [hidden email]
> Subject: LazyInitializationException for ASO?
>
>
> Hi All,
>
> I have a very simple layout component where I look for two ASOs and
> display
> text based on them.  Component snip: http://pastebin.com/m69540e56.  Tml
> snip: http://pastebin.com/m4435806f.  I am getting this exception
> http://pastebin.com/m42ec222a.  I dont have any hibernate session injected
> and I am not calling any getters of objects that would throw a lazy init
> exception.  This happens even right after I restart jetty so both ASOs
> should be null right?  When I return null for getSurvey() the exception
> goes
> away.  Any ideas?
>
> Thanks in advance,
> Zack
> --
> View this message in context:
> http://n2.nabble.com/LazyInitializationException-for-ASO--
> tp363398p363398.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: LazyInitializationException for ASO?

zack.manning
Yea that seems to have done it.  Shouldnt I be able to just check if the ASO is null?  Every @ApplicationState of mine is set create = false.  I might use that other places in the app and just want make sure I know the cause of the error so it doesnt crop up elsewhere.

Zack

Jonathan Barker wrote
Are there any places where you use the @ApplicationState annotation for
Survey or Project without create=false?

What happens if you test on "surveyExists" which would be the way before the
create=false option was introduced?
Reply | Threaded
Open this post in threaded view
|

RE: LazyInitializationException for ASO?

Jonathan Barker

I think you should.

It looks like Tapestry is having the problem displaying the error page.  You
have the conditional for outside the ifLoggedIn check.  Out of curiosity,
what happens if that is moved inside the ifLoggedIn check?

I'm wondering if the Acegi RememberMe filter is putting a detached Hibernate
object into the HTTP Session that Tapestry is trying to display on an error
page, thereby triggering the exception.  So you would be seeing the error
because you are triggering another error... or not ;-)

Jonathan




> -----Original Message-----
> From: zack.manning [mailto:[hidden email]]
> Sent: Monday, July 07, 2008 14:40
> To: [hidden email]
> Subject: RE: LazyInitializationException for ASO?
>
>
> Yea that seems to have done it.  Shouldnt I be able to just check if the
> ASO
> is null?  Every @ApplicationState of mine is set create = false.  I might
> use that other places in the app and just want make sure I know the cause
> of
> the error so it doesnt crop up elsewhere.
>
> Zack
>
>
> Jonathan Barker wrote:
> >
> >
> > Are there any places where you use the @ApplicationState annotation for
> > Survey or Project without create=false?
> >
> > What happens if you test on "surveyExists" which would be the way before
> > the
> > create=false option was introduced?
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/LazyInitializationException-for-ASO--
> tp363398p363430.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: LazyInitializationException for ASO?

zack.manning
Ha there you go.  Modified code to this: http://pastebin.com/m7f98ffbe and all worked fine without surveyExists.  This is good to note for future acegi-based development :)  Thanks so much for your help!

Zack

Jonathan Barker wrote
I think you should.

It looks like Tapestry is having the problem displaying the error page.  You
have the conditional for outside the ifLoggedIn check.  Out of curiosity,
what happens if that is moved inside the ifLoggedIn check?

I'm wondering if the Acegi RememberMe filter is putting a detached Hibernate
object into the HTTP Session that Tapestry is trying to display on an error
page, thereby triggering the exception.  So you would be seeing the error
because you are triggering another error... or not ;-)

Jonathan




> -----Original Message-----
> From: zack.manning [mailto:zack.manning@gmail.com]
> Sent: Monday, July 07, 2008 14:40
> To: users@tapestry.apache.org
> Subject: RE: LazyInitializationException for ASO?
>
>
> Yea that seems to have done it.  Shouldnt I be able to just check if the
> ASO
> is null?  Every @ApplicationState of mine is set create = false.  I might
> use that other places in the app and just want make sure I know the cause
> of
> the error so it doesnt crop up elsewhere.
>
> Zack
>
>
> Jonathan Barker wrote:
> >
> >
> > Are there any places where you use the @ApplicationState annotation for
> > Survey or Project without create=false?
> >
> > What happens if you test on "surveyExists" which would be the way before
> > the
> > create=false option was introduced?
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/LazyInitializationException-for-ASO--
> tp363398p363430.html
> Sent from the Tapestry Users mailing list archive at Nabble.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