-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Lazy instantiation problem with template generation
PostPosted: Thu Apr 07, 2005 10:23 am 
Regular
Regular

Joined: Fri Sep 17, 2004 10:51 am
Posts: 61
Location: Rimini, Italy
Hi, I'm having a problem with lazy instantiation when using a template engine (WebMacro). I'm getting sometimes the error

Code:
16:17:08,939 ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:80)
        at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
        at ejb.catalog.Autore$$EnhancerByCGLIB$$1390b281.getNome(<generated>)
        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.webmacro.engine.PropertyOperator.invoke(PropertyOperatorCache.java:864)
        at org.webmacro.engine.UnaryMethodAccessor.get(PropertyOperatorCache.java:1230)
        at org.webmacro.engine.PropertyOperator.getProperty(PropertyOperatorCache.java:651)
        at org.webmacro.engine.PropertyOperatorCache.getProperty(PropertyOperatorCache.java:142)
        at org.webmacro.Context.internalGet(Context.java:387)
        at org.webmacro.Context.getProperty(Context.java:439)
...


I'm using Hibernate 3 final and I've configured it to bind the session factory to JNDI. I use a filter to close the session after the last servlet complete the execution.
Where should I look for hints on this problem ?
TIA[/code]

_________________
--
Marco


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 10:28 am 
Regular
Regular

Joined: Fri Sep 17, 2004 10:51 am
Posts: 61
Location: Rimini, Italy
More info on this:

Object HBM:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>

<class
    name="ejb.catalog.Articolo"
    table="ARTICOLO"
>
    <meta attribute="extends">ejb.catalog.AbstractArticolo</meta>
    <cache usage="read-write" />
    <id
        name="id"
        type="java.lang.String"
        column="ID"
    >
        <generator class="assigned" />
    </id>
(some properties)
    <many-to-one
        name="autore"
        class="ejb.catalog.Autore"
        not-null="true"
    >
        <column name="AUTOREID" />
    </many-to-one>
</class>
(some named queries)
</hibernate-mapping>

_________________
--
Marco


Top
 Profile  
 
 Post subject: Solved
PostPosted: Thu Apr 07, 2005 11:38 am 
Regular
Regular

Joined: Fri Sep 17, 2004 10:51 am
Posts: 61
Location: Rimini, Italy
Ok, I think I've solved the problem: I was using a local cache for search results, so the pojo where referring to the session closed in the previous request.

_________________
--
Marco


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.