I just recently started my first Hibernate/Tapestry project and - to make the learning curve even a bit steeper - added Springframework to it, which was new to me too. I'm sure I'm only scratching the surface of Springframework for now, but it works well for the problem you've described. I had to invest maybe 1 additional day to integrate it.

Cheers,
Will

On 28.07.2005, at 21:52, Chris Chiappone 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(AbstractLazyInit ializer.java:53) org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractL azyInitializer.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.ja va:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso rImpl.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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to