I've wrote a little article on some solutions at http://pruggia.blogspot.com

On 7/28/05, Chris Chiappone <[EMAIL PROTECTED]> wrote:
> 
> I have been developing an application using tapestry 3.0.3 and
> hibernate 3.0.2. Took a while to get everything working correctly,
> and learning both of the frameworks. I have a decent amount of the
> application written and now am running into
> LazyInitializationException in certain places. Its strange because I
> can't expain why I get the exception and other times I don't.
> 
> I've read that using the Spring Framework would fix this problem, but
> wonder if its worth learning another framework and trying to integrate
> it into my application. I'm on a deadline and this may just take to
> long. I've also extended BaseEngine to do this trying to relieve my
> problem:
> 
> 
> protected void cleanupAfterRequest(IRequestCycle cycle) {
> try {
> 
> HibernateUtil.commitTransaction();
> 
> if (killSession) {
> try {
> HttpSession session =
> cycle.getRequestContext()
> .getSession();
> 
> if (session != null) {
> log.info("Logging out user.");
> session.invalidate();
> }
> } catch (IllegalStateException ex) {
> // Ignore.
> }
> 
> }
> } catch (NestedRuntimeException nre) {
> 
> } finally {
> HibernateUtil.closeSession();
> }
> }
> Yet I still run into this exception:
> 
> Unable to resolve expression 'currentCompany.name' for
> [EMAIL PROTECTED]
> binding: ExpressionBinding[EditProfile currentCompany.name]
> location: context:/WEB-INF/EditProfile.page, line 41, column 65
> 
> ognl.OgnlException
> name
> 
> org.hibernate.LazyInitializationException
> could not initialize proxy - the owning Session was closed
> messages: [Ljava.lang.String;@cdf872
> throwableCount: 1
> throwables: [Ljava.lang.Throwable;@7227a8
> Stack Trace:
> org.hibernate.proxy.AbstractLazyInitializer.initialize(
> AbstractLazyInitializer.java:53)
> org.hibernate.proxy.AbstractLazyInitializer.getImplementation(
> AbstractLazyInitializer.java:84)
> org.hibernate.proxy.CGLIBLazyInitializer.intercept(
> CGLIBLazyInitializer.java:134)
> domain.company.Company$$EnhancerByCGLIB$$f029e618.getName(<generated>)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> 
> 
> Is there anything else I should try. Or is the spring framework the
> way to go. If so is it easy to integrate into an existing
> applicatoin? Thanks.
> --
> ~chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to