ERROR org.hibernate.LazyInitializationException - could not initialize proxy - the owning Session was closed.
Mapping:
<?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>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="gov.noaa.nwfsc.omi.sdm.wqbemp.hibernate.model.Wqvisit"
table="WQVISIT"
>
<id
name="visitId"
type="long"
column="VISIT_ID"
>
<generator class="assigned" />
</id>
<property
name="visitPersonName"
type="java.lang.String"
column="VISIT_PERSON_NAME"
not-null="true"
length="30"
/>
<property
name="dateOut"
type="java.sql.Date"
column="DATE_OUT"
length="7"
/>
<property
name="dateIn"
type="java.sql.Date"
column="DATE_IN"
not-null="true"
length="7"
/>
<property
name="visitComment"
type="java.lang.String"
column="VISIT_COMMENT"
length="4000"
/>
<property
name="flowId"
type="long"
column="FLOW_ID"
length="11"
/>
<property
name="dataFilePath"
type="java.lang.String"
column="DATA_FILE_PATH"
length="255"
/>
<!-- Associations -->
<!-- bi-directional many-to-one association to Wqsite -->
<many-to-one
name="wqsite"
lazy="false"
class="gov.noaa.nwfsc.omi.sdm.wqbemp.hibernate.model.Wqsite"
not-null="true"
>
<column name="SITE_ID" />
</many-to-one>
<!-- bi-directional many-to-one association to Monitor -->
<many-to-one
name="monitorByMonitorInId"
lazy="false"
class="gov.noaa.nwfsc.omi.sdm.wqbemp.hibernate.model.Monitor"
not-null="true"
>
<column name="MONITOR_IN_ID" />
</many-to-one>
<!-- bi-directional many-to-one association to Monitor -->
<many-to-one
name="monitorByMonitorOutId"
lazy="false"
class="gov.noaa.nwfsc.omi.sdm.wqbemp.hibernate.model.Monitor"
not-null="true"
>
<column name="MONITOR_OUT_ID" />
</many-to-one>
</class>
</hibernate-mapping>
I try to access wqsite set on the many-to-one relation above. I have lazy="false" but still get the error. I thought with lazy="false" all objects assoiciated are loaded completely. Any hints, I read the documentation and thought it states that I should have objects loaded when specifying lazy="false"
Thank You and forgive me if I am stupidly miss-understanding some obvious facts. I use hibernate 3.1